Upgrade System
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c268782130b3d544cb63b578e93b50eb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class UpgradesData : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TextAsset upgradesJSON;
|
||||
|
||||
public Upgrades upgrades;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
upgrades = JsonUtility.FromJson<Upgrades>(upgradesJSON.text);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Upgrade
|
||||
{
|
||||
public string name;
|
||||
public string paramName;
|
||||
public float value;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Upgrades
|
||||
{
|
||||
public Upgrade[] upgrades;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 132f6eb0a04c6614d9ebb227a443e2a6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -196,3 +196,4 @@ MonoBehaviour:
|
||||
Speed: 1
|
||||
Damages: 100
|
||||
Life: 1000
|
||||
_orb: {fileID: 4247841200454641178, guid: 5f995817aeb7ddc4e841633e73c7ff59, type: 3}
|
||||
|
||||
@@ -12,9 +12,11 @@ public class Ennemy : MonoBehaviour
|
||||
private SpriteRenderer _sr;
|
||||
private Transform _player;
|
||||
|
||||
public float Life = 100;
|
||||
public float Speed = .1f;
|
||||
public int Damages = 1;
|
||||
public int Life = 100;
|
||||
|
||||
[SerializeField] private GameObject _orb;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -31,14 +33,33 @@ public class Ennemy : MonoBehaviour
|
||||
if (gameObject.name.Contains("Mayor"))
|
||||
{
|
||||
_player.GetComponent<PlayerManager>().MayorKills++;
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
Instantiate(_orb, transform.position, Quaternion.identity);
|
||||
}
|
||||
else if (gameObject.name.Contains("Minotaur"))
|
||||
}
|
||||
else if (gameObject.name.Contains("Minautor"))
|
||||
{
|
||||
_player.GetComponent<PlayerManager>().MinautorKills++;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
GameObject _spawnedOrb = Instantiate(_orb, transform.position, Quaternion.identity);
|
||||
_spawnedOrb.GetComponent<OrbStats>().OrbValue = OrbValues.Ten;
|
||||
}
|
||||
}
|
||||
else if(gameObject.name.Contains("Bringer of Death"))
|
||||
{
|
||||
_player.GetComponent<PlayerManager>().BringerOfDeathKills++;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
GameObject _spawnedOrb = Instantiate(_orb, transform.position, Quaternion.identity);
|
||||
_spawnedOrb.GetComponent<OrbStats>().OrbValue = OrbValues.Hundred;
|
||||
}
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
GameObject _spawnedOrb = Instantiate(_orb, transform.position, Quaternion.identity);
|
||||
_spawnedOrb.GetComponent<OrbStats>().OrbValue = OrbValues.Ten;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ MonoBehaviour:
|
||||
Speed: 0.2
|
||||
Damages: 10
|
||||
Life: 100
|
||||
_orb: {fileID: 4247841200454641178, guid: 5f995817aeb7ddc4e841633e73c7ff59, type: 3}
|
||||
--- !u!61 &247299863115505385
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -196,3 +196,4 @@ MonoBehaviour:
|
||||
Speed: 0.7
|
||||
Damages: 75
|
||||
Life: 500
|
||||
_orb: {fileID: 4247841200454641178, guid: 5f995817aeb7ddc4e841633e73c7ff59, type: 3}
|
||||
|
||||
@@ -123,7 +123,7 @@ CircleCollider2D:
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_Bits: 8
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -16,6 +16,8 @@ public class OrbStats : MonoBehaviour
|
||||
private void Start()
|
||||
{
|
||||
_sr = GetComponent<SpriteRenderer>();
|
||||
|
||||
transform.Translate(new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f)));
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
@@ -41,6 +41,7 @@ Transform:
|
||||
- {fileID: 4152598028236711869}
|
||||
- {fileID: 4740856695113674186}
|
||||
- {fileID: 1598670840411184170}
|
||||
- {fileID: 749125587594098812}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &4824869534615406026
|
||||
@@ -262,12 +263,24 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
Health: 100
|
||||
MaxHealth: 100
|
||||
HealValue: 1
|
||||
Speed: 2
|
||||
Exp: 0
|
||||
Level: 1
|
||||
BeamDamages: 50
|
||||
BeamFequency: 5
|
||||
SwordsDamages: 25
|
||||
ArrowDamages: 15
|
||||
ArrowRange: 5
|
||||
ArrowFrequency: 2
|
||||
laserOnX: 0
|
||||
laserOnY: 0
|
||||
MayorKills: 0
|
||||
MinautorKills: 0
|
||||
BringerOfDeathKills: 0
|
||||
pauseMenu: {fileID: 1161238801143918071}
|
||||
deathScreen: {fileID: 8536456763282141865}
|
||||
_upgradeScreen: {fileID: 3552072345333957438}
|
||||
--- !u!114 &2991086602376010793
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -281,8 +294,6 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
laser: {fileID: 4893257253370123985, guid: 95cb513377bf0e248bd66d6f7ddae920, type: 3}
|
||||
laserOnX: 0
|
||||
laserOnY: 0
|
||||
arrow: {fileID: 6280786298679187013, guid: 856a449688373494987701d49b79a7af, type: 3}
|
||||
--- !u!1001 &993819705047970090
|
||||
PrefabInstance:
|
||||
@@ -292,10 +303,6 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 3622515600777588477}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8230784050683220836, guid: fd7d128113472244d88a3fc511da99a0, type: 3}
|
||||
propertyPath: initialSwordsCount
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3957911104700806788, guid: fd7d128113472244d88a3fc511da99a0, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Halo
|
||||
@@ -513,6 +520,10 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Death Screen
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7779035698592798071, guid: be2de9e5d757ee447a79f8ad0528d930, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
@@ -528,3 +539,70 @@ GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7779035698592798071, guid: be2de9e5d757ee447a79f8ad0528d930, type: 3}
|
||||
m_PrefabInstance: {fileID: 2126607160633550814}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &3519923663120457319
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 3622515600777588477}
|
||||
m_Modifications:
|
||||
- target: {fileID: 113215708914507097, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Upgrade Screen
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
--- !u!4 &749125587594098812 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4232304121047868955, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
m_PrefabInstance: {fileID: 3519923663120457319}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &3552072345333957438 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 113215708914507097, guid: c16dc07d15aa39d4ba76ea86b13d279e, type: 3}
|
||||
m_PrefabInstance: {fileID: 3519923663120457319}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
@@ -3,17 +3,25 @@ using UnityEngine;
|
||||
|
||||
[
|
||||
RequireComponent(typeof(PlayerManager)),
|
||||
RequireComponent(typeof(SpriteRenderer))
|
||||
RequireComponent(typeof(SpriteRenderer)),
|
||||
RequireComponent(typeof(CircleCollider2D))
|
||||
]
|
||||
public class PlayerCollisions : MonoBehaviour
|
||||
{
|
||||
private PlayerManager _pm;
|
||||
private PlayerManager _manager;
|
||||
private SpriteRenderer _sr;
|
||||
private CircleCollider2D _trigger;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_pm = GetComponent<PlayerManager>();
|
||||
_manager = GetComponent<PlayerManager>();
|
||||
_sr = GetComponent<SpriteRenderer>();
|
||||
_trigger = GetComponent<CircleCollider2D>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_trigger.radius = _manager.OrbAbsorberRadius;
|
||||
}
|
||||
|
||||
private void OnTriggerStay2D(Collider2D collision)
|
||||
@@ -39,7 +47,7 @@ public class PlayerCollisions : MonoBehaviour
|
||||
|
||||
if (orb.transform.position == transform.position)
|
||||
{
|
||||
_pm.AddExperience((int)orb.GetComponent<OrbStats>().OrbValue);
|
||||
_manager.AddExperience((int)orb.GetComponent<OrbStats>().OrbValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,28 +3,44 @@ using UnityEngine;
|
||||
public class PlayerManager : MonoBehaviour
|
||||
{
|
||||
// Character stats
|
||||
public int Health = 100;
|
||||
public int MaxHealth = 100;
|
||||
public int HealValue = 1;
|
||||
[Header("Character Stats")]
|
||||
public float Health = 100f;
|
||||
public float MaxHealth = 100f;
|
||||
public float HealValue = 1f;
|
||||
public float Speed = 2f;
|
||||
public int Exp = 0;
|
||||
public int Level = 1;
|
||||
public float Exp = 0f;
|
||||
public float Level = 1f;
|
||||
public float OrbAbsorberRadius = 0.7f;
|
||||
|
||||
// Weapons stats
|
||||
public int BeamDamages = 50;
|
||||
public int SwordsDamages = 25;
|
||||
public int ArrowDamages = 15;
|
||||
[Header("Weapons Stats")]
|
||||
public float BeamDamages = 50f;
|
||||
public float BeamFrequency = 5f;
|
||||
public float BeamLife = 0.5f;
|
||||
|
||||
public float SwordsHaloRadius = 1f;
|
||||
public float SwordsDamages = 25f;
|
||||
public float SwordsQuantity = 5f;
|
||||
|
||||
public float ArrowDamages = 15f;
|
||||
public float ArrowRange = 5f;
|
||||
public float ArrowFrequency = 2f;
|
||||
|
||||
public float laserOnX = 0f;
|
||||
public float laserOnY = 0f;
|
||||
|
||||
// Kills stats
|
||||
[Header("Kills Stats")]
|
||||
public int MayorKills = 0;
|
||||
public int MinautorKills = 0;
|
||||
public int BringerOfDeathKills = 0;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject pauseMenu;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject deathScreen;
|
||||
[SerializeField]
|
||||
private GameObject _upgradeScreen;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -33,6 +49,16 @@ public class PlayerManager : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (BeamFrequency < 0f)
|
||||
{
|
||||
BeamFrequency = 0f;
|
||||
}
|
||||
|
||||
if (ArrowFrequency < 0.5f)
|
||||
{
|
||||
ArrowFrequency = 0.5f;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
pauseMenu.SetActive(true);
|
||||
@@ -48,6 +74,9 @@ public class PlayerManager : MonoBehaviour
|
||||
{
|
||||
Exp -= Level * 10;
|
||||
Level++;
|
||||
Time.timeScale = 0f;
|
||||
_upgradeScreen.SetActive(true);
|
||||
_upgradeScreen.GetComponentInChildren<UpgradeScreen>().GenerateChoice();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +88,9 @@ public class PlayerManager : MonoBehaviour
|
||||
{
|
||||
Health = 0;
|
||||
|
||||
// Death animation + menu
|
||||
Time.timeScale = 0f;
|
||||
deathScreen.SetActive(true);
|
||||
deathScreen.GetComponent<DeathScreen>().ShowScreen();
|
||||
} else
|
||||
{
|
||||
// Damage animation
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +1,84 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent (typeof(PlayerMovements))]
|
||||
public class PlayerWeapons : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject laser;
|
||||
[SerializeField] private bool laserOnX;
|
||||
[SerializeField] private bool laserOnY;
|
||||
|
||||
[SerializeField] private GameObject arrow;
|
||||
|
||||
private PlayerMovements _pm;
|
||||
private PlayerManager _manager;
|
||||
|
||||
private float oldBeamFrequency;
|
||||
private bool oldBeamX;
|
||||
private bool oldBeamY;
|
||||
|
||||
private float oldArrowFrequency;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_pm = GetComponent<PlayerMovements>();
|
||||
_manager = GetComponent<PlayerManager>();
|
||||
|
||||
InvokeRepeating(nameof(ShootBeam), 5f, 5f);
|
||||
InvokeRepeating(nameof(ShootArrow), 2f, 2f);
|
||||
oldBeamFrequency = _manager.BeamFrequency;
|
||||
oldBeamX = Convert.ToBoolean(_manager.laserOnX);
|
||||
oldBeamY = Convert.ToBoolean(_manager.laserOnY);
|
||||
oldArrowFrequency = _manager.ArrowFrequency;
|
||||
|
||||
InvokeRepeating(nameof(ShootBeam), _manager.BeamFrequency, _manager.BeamFrequency);
|
||||
InvokeRepeating(nameof(ShootArrow), _manager.ArrowFrequency, _manager.ArrowFrequency);
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (_manager.BeamFrequency != oldBeamFrequency)
|
||||
{
|
||||
if (_manager.BeamFrequency > 0f)
|
||||
{
|
||||
CancelInvoke(nameof(ShootBeam));
|
||||
InvokeRepeating(nameof(ShootBeam), _manager.BeamFrequency, _manager.BeamFrequency);
|
||||
}
|
||||
else
|
||||
{
|
||||
CancelInvoke(nameof(ShootBeam));
|
||||
ShootBeam();
|
||||
}
|
||||
oldBeamFrequency = _manager.BeamFrequency;
|
||||
}
|
||||
|
||||
if (_manager.BeamFrequency == 0)
|
||||
{
|
||||
if (oldBeamX != Convert.ToBoolean(_manager.laserOnX) || oldBeamY != Convert.ToBoolean(_manager.laserOnY))
|
||||
{
|
||||
foreach (var beam in GameObject.FindGameObjectsWithTag("Beam"))
|
||||
{
|
||||
Destroy(beam);
|
||||
}
|
||||
oldBeamX = Convert.ToBoolean(_manager.laserOnX);
|
||||
oldBeamY = Convert.ToBoolean(_manager.laserOnY);
|
||||
ShootBeam();
|
||||
}
|
||||
}
|
||||
|
||||
if (_manager.ArrowFrequency != oldArrowFrequency)
|
||||
{
|
||||
CancelInvoke(nameof(ShootArrow));
|
||||
InvokeRepeating(nameof(ShootArrow), _manager.ArrowFrequency, _manager.ArrowFrequency);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShootBeam()
|
||||
{
|
||||
GameObject defaultBeam = Instantiate(laser, transform.position, _pm.lookOnRight ? Quaternion.identity : Quaternion.Euler(0, 0, 180), transform);
|
||||
defaultBeam.GetComponent<LaserBeam>().Damages = _manager.BeamDamages;
|
||||
Instantiate(laser, transform.position, Quaternion.identity, transform);
|
||||
|
||||
if (laserOnX)
|
||||
if (_manager.laserOnX > 0)
|
||||
{
|
||||
Instantiate(laser, transform.position, _pm.lookOnRight ? Quaternion.Euler(0, 0, 180) : Quaternion.identity, transform);
|
||||
Instantiate(laser, transform.position, Quaternion.Euler(0, 0, 180), transform);
|
||||
}
|
||||
|
||||
if (laserOnY)
|
||||
if (_manager.laserOnY > 0)
|
||||
{
|
||||
Instantiate(laser, transform.position, Quaternion.Euler(0, 0, 90), transform);
|
||||
Instantiate(laser, transform.position, Quaternion.Euler(0, 0, 270), transform);
|
||||
@@ -43,7 +89,7 @@ public class PlayerWeapons : MonoBehaviour
|
||||
private void ShootArrow()
|
||||
{
|
||||
// Get all enemies in given radius
|
||||
Collider2D[] hits = Physics2D.OverlapCircleAll(transform.position, 20f, LayerMask.GetMask("Enemy"));
|
||||
Collider2D[] hits = Physics2D.OverlapCircleAll(transform.position, _manager.ArrowRange, LayerMask.GetMask("Enemy"));
|
||||
|
||||
if (hits.Length <= 0)
|
||||
{
|
||||
@@ -68,7 +114,6 @@ public class PlayerWeapons : MonoBehaviour
|
||||
{
|
||||
GameObject spawnedArrow = Instantiate(arrow, transform.position, Quaternion.identity);
|
||||
spawnedArrow.GetComponent<Arrow>().target = target;
|
||||
spawnedArrow.GetComponent<Arrow>().Damages = _manager.ArrowDamages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b31da364d35d380469688df14b1292f7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"upgrades": [
|
||||
{
|
||||
"name": "Max health",
|
||||
"paramName": "MaxHealth",
|
||||
"value": 25
|
||||
},
|
||||
{
|
||||
"name": "Heal quantity",
|
||||
"paramName": "HealValue",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"name": "Movement speed",
|
||||
"paramName": "Speed",
|
||||
"value": 0.5
|
||||
},
|
||||
{
|
||||
"name": "Orb Absorber radius",
|
||||
"paramName": "OrbAbsorberRadius",
|
||||
"value": 0.2
|
||||
},
|
||||
{
|
||||
"name": "Beam damages",
|
||||
"paramName": "BeamDamages",
|
||||
"value": 15
|
||||
},
|
||||
{
|
||||
"name": "Beam frequency",
|
||||
"paramName": "BeamFrequency",
|
||||
"value": -0.5
|
||||
},
|
||||
{
|
||||
"name": "2 Horizontal beams",
|
||||
"paramName": "laserOnX",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"name": "2 Vertical beams",
|
||||
"paramName": "laserOnY",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"name": "Swords' Halo radius",
|
||||
"paramName": "SwordsHaloRadius",
|
||||
"value": 0.1
|
||||
},
|
||||
{
|
||||
"name": "Swords damages",
|
||||
"paramName": "SwordsDamages",
|
||||
"value": 25
|
||||
},
|
||||
{
|
||||
"name": "Swords quantity",
|
||||
"paramName": "SwordsQuantity",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"name": "Arrow damages",
|
||||
"paramName": "ArrowDamages",
|
||||
"value": 15
|
||||
},
|
||||
{
|
||||
"name": "Arrow range",
|
||||
"paramName": "ArrowRange",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"name": "Arrow frequency",
|
||||
"paramName": "ArrowFrequency",
|
||||
"value": -0.5
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaa2ab8454f62084e836d4c194574793
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+30
-126
@@ -286,125 +286,15 @@ PrefabInstance:
|
||||
propertyPath: m_Name
|
||||
value: Start UI
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6939379890176807053, guid: 4ce1de8b166656e4a97422e7ac85530b, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 4ce1de8b166656e4a97422e7ac85530b, type: 3}
|
||||
--- !u!1001 &1521100303
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1374640533067853523, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Minautor
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -4.1252995
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -1.4422002
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2275453484761280344, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 5115e3c062ab0d94c993c9a01963c9bb, type: 3}
|
||||
--- !u!1001 &1803491063
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 6061697268588932327, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Mayor
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -4.53618
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.03178945
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8999614972709205858, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 797fec3354cfff54e95743a263e79f8f, type: 3}
|
||||
--- !u!1001 &5393968438828368982
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -413,20 +303,20 @@ PrefabInstance:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3553905824341430, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: initialSwordsCount
|
||||
value: 5
|
||||
- target: {fileID: 1161238801143918071, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1784956759114531697, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Player
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2991086602376010793, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: laserOnX
|
||||
- target: {fileID: 3552072345333957438, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2991086602376010793, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: laserOnY
|
||||
- target: {fileID: 3599206546858926089, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3622515600777588477, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
@@ -469,9 +359,25 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4281658155561392569, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_AdditionalShaderChannelsFlag
|
||||
value: 25
|
||||
- target: {fileID: 7600806342610375037, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: upgrades.upgrades.Array.size
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8339747699126584523, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: laserOnY
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8339747699126584523, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: BeamFrequency
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8872681192320925159, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8872681192320925159, guid: 05d927a24df204541afbb77f1af3a9a2, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
@@ -541,7 +447,5 @@ SceneRoots:
|
||||
m_Roots:
|
||||
- {fileID: 519420032}
|
||||
- {fileID: 5393968438828368982}
|
||||
- {fileID: 1803491063}
|
||||
- {fileID: 5921508570549303515}
|
||||
- {fileID: 1252793503}
|
||||
- {fileID: 1521100303}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47fcba8703a71c54ba2a75bf1ecc6db0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
[RequireComponent(typeof(UpgradesData))]
|
||||
public class UpgradeScreen : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private List<Button> buttons = new();
|
||||
|
||||
private Upgrade[] _upgrades;
|
||||
private PlayerManager _manager;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_manager = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerManager>();
|
||||
_upgrades = GetComponent<UpgradesData>().upgrades.upgrades;
|
||||
|
||||
GenerateChoice();
|
||||
}
|
||||
|
||||
public void GenerateChoice()
|
||||
{
|
||||
Upgrade[] choosen = new Upgrade[buttons.Count];
|
||||
|
||||
while (choosen.Length != choosen.Distinct().Count())
|
||||
{
|
||||
for(int i = 0; i < choosen.Length; i++)
|
||||
{
|
||||
Upgrade choosenUpgrade = _upgrades[Random.Range(0, _upgrades.Length)];
|
||||
|
||||
bool beamCondition = (choosenUpgrade.paramName == "laserOnX" && _manager.laserOnX >= 1) || (choosenUpgrade.paramName == "laserOnY" && _manager.laserOnY >= 1);
|
||||
bool beamFrequencyCondition = (choosenUpgrade.paramName == "BeamFrequency" && _manager.BeamFrequency <= 0);
|
||||
bool arrowFrequency = (choosenUpgrade.paramName == "ArrowFrequency" && _manager.ArrowFrequency <= 0.5f);
|
||||
|
||||
while (beamCondition || beamFrequencyCondition || arrowFrequency)
|
||||
{
|
||||
choosenUpgrade = _upgrades[Random.Range(0, _upgrades.Length)];
|
||||
|
||||
beamCondition = (choosenUpgrade.paramName == "laserOnX" && _manager.laserOnX >= 1) || (choosenUpgrade.paramName == "laserOnY" && _manager.laserOnY >= 1);
|
||||
beamFrequencyCondition = (choosenUpgrade.paramName == "BeamFrequency" && _manager.BeamFrequency <= 0);
|
||||
arrowFrequency = (choosenUpgrade.paramName == "ArrowFrequency" && _manager.ArrowFrequency <= 0.5f);
|
||||
};
|
||||
|
||||
choosen[i] = choosenUpgrade;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var button in buttons.Select((value, i) => new {i, value}))
|
||||
{
|
||||
button.value.GetComponentInChildren<TMP_Text>().SetText(choosen[button.i].name);
|
||||
button.value.GetComponent<Button>().onClick.AddListener(() => { UpgradePlayer(button.value, _upgrades, _manager); });
|
||||
}
|
||||
}
|
||||
|
||||
public void UpgradePlayer(Button button, Upgrade[] upgrades, PlayerManager manager)
|
||||
{
|
||||
for (int i = 0; i < upgrades.Length; i++)
|
||||
{
|
||||
if (upgrades[i].name == button.GetComponentInChildren<TMP_Text>().text)
|
||||
{
|
||||
FieldInfo field = manager.GetType().GetField(upgrades[i].paramName);
|
||||
float fieldValue = (float)field.GetValue(manager);
|
||||
|
||||
field.SetValue(manager, fieldValue + upgrades[i].value);
|
||||
|
||||
Time.timeScale = 1f;
|
||||
button.transform.parent.parent.parent.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e0d6eae981931e49af7552730883326
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c16dc07d15aa39d4ba76ea86b13d279e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,24 +2,30 @@ using UnityEngine;
|
||||
|
||||
public class Arrow : MonoBehaviour
|
||||
{
|
||||
public int Damages = 15;
|
||||
|
||||
public GameObject target;
|
||||
|
||||
private PlayerManager _manager;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_manager = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerManager>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
transform.position = Vector3.MoveTowards(transform.position, target.transform.position, 20f * Time.deltaTime);
|
||||
if (target == null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
transform.position = Vector3.MoveTowards(transform.position, target.transform.position, 20f * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.CompareTag("Ennemy"))
|
||||
{
|
||||
collision.gameObject.GetComponent<Ennemy>().Life -= Damages;
|
||||
collision.gameObject.GetComponent<Ennemy>().Life -= _manager.ArrowDamages;
|
||||
collision.gameObject.GetComponent<Ennemy>().AnimateHit();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ BoxCollider2D:
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_Bits: 63
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
|
||||
+50
-13
@@ -3,23 +3,27 @@ using UnityEngine;
|
||||
|
||||
public class Halo : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private int radius = 1;
|
||||
[SerializeField]
|
||||
private int initialSwordsCount = 5;
|
||||
[SerializeField]
|
||||
private GameObject _sword;
|
||||
|
||||
private PlayerManager _manager;
|
||||
private List<GameObject> swords = new();
|
||||
|
||||
private float _oldRadius;
|
||||
private int _oldSwordsCount;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
float angle = Mathf.PI*2f / initialSwordsCount;
|
||||
for(int i = 0; i < initialSwordsCount; i++)
|
||||
_manager = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerManager>();
|
||||
_oldRadius = _manager.SwordsHaloRadius;
|
||||
_oldSwordsCount = (int)_manager.SwordsQuantity;
|
||||
|
||||
float angle = Mathf.PI*2f / _manager.SwordsQuantity;
|
||||
for(int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
{
|
||||
GameObject sword = Instantiate(
|
||||
_sword,
|
||||
transform.position + new Vector3(Mathf.Cos(i * angle), Mathf.Sin(i * angle), 0),
|
||||
transform.position + new Vector3(Mathf.Cos(i * angle) * _manager.SwordsHaloRadius, Mathf.Sin(i * angle) * _manager.SwordsHaloRadius, 0),
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
@@ -29,28 +33,61 @@ public class Halo : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_oldRadius != _manager.SwordsHaloRadius)
|
||||
{
|
||||
_oldRadius = _manager.SwordsHaloRadius;
|
||||
ResizeHalo();
|
||||
}
|
||||
|
||||
if (_oldSwordsCount != _manager.SwordsQuantity)
|
||||
{
|
||||
AddSword();
|
||||
_oldSwordsCount = (int)_manager.SwordsQuantity;
|
||||
}
|
||||
|
||||
transform.Rotate(Vector3.forward, 200f * Time.deltaTime, Space.Self);
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.DrawWireSphere(transform.position, radius);
|
||||
Gizmos.DrawWireSphere(transform.position, _manager ? _manager.SwordsHaloRadius : 1f);
|
||||
}
|
||||
|
||||
public void AddSword()
|
||||
private void AddSword()
|
||||
{
|
||||
for(int i = 0; i < swords.Count; i++)
|
||||
for (int i = 0; i < _oldSwordsCount; i++)
|
||||
{
|
||||
Destroy(swords[i]);
|
||||
}
|
||||
swords.Clear();
|
||||
|
||||
float angle = Mathf.PI * 2f / initialSwordsCount;
|
||||
for (int i = 0; i < initialSwordsCount; i++)
|
||||
float angle = Mathf.PI * 2f / _manager.SwordsQuantity;
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
{
|
||||
GameObject sword = Instantiate(
|
||||
_sword,
|
||||
transform.position + new Vector3(Mathf.Cos(i * angle), Mathf.Sin(i * angle), 0),
|
||||
transform.position + new Vector3(Mathf.Cos(i * angle) * _manager.SwordsHaloRadius, Mathf.Sin(i * angle) * _manager.SwordsHaloRadius, 0),
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
swords.Add(sword);
|
||||
}
|
||||
}
|
||||
|
||||
private void ResizeHalo()
|
||||
{
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
{
|
||||
DestroyImmediate(swords[i]);
|
||||
}
|
||||
swords.Clear();
|
||||
|
||||
float angle = Mathf.PI * 2f / _manager.SwordsQuantity;
|
||||
for (int i = 0; i < _manager.SwordsQuantity; i++)
|
||||
{
|
||||
GameObject sword = Instantiate(
|
||||
_sword,
|
||||
transform.position + new Vector3(Mathf.Cos(i * angle) * _manager.SwordsHaloRadius, Mathf.Sin(i * angle) * _manager.SwordsHaloRadius, 0),
|
||||
Quaternion.identity,
|
||||
transform
|
||||
);
|
||||
|
||||
@@ -45,5 +45,5 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
radius: 1
|
||||
initialSwordsCount: 10
|
||||
initialSwordsCount: 5
|
||||
_sword: {fileID: 4974588604955100116, guid: d21b2e937bf67eb4c8fc3db75696d4ce, type: 3}
|
||||
|
||||
@@ -3,8 +3,6 @@ using UnityEngine;
|
||||
[RequireComponent (typeof(BoxCollider2D))]
|
||||
public class Sword : MonoBehaviour
|
||||
{
|
||||
public int Damages = 25;
|
||||
|
||||
private PlayerManager _manager;
|
||||
|
||||
private void Start()
|
||||
@@ -14,7 +12,6 @@ public class Sword : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Damages = _manager.SwordsDamages;
|
||||
RotateSword();
|
||||
}
|
||||
|
||||
@@ -35,7 +32,7 @@ public class Sword : MonoBehaviour
|
||||
{
|
||||
if (collision.CompareTag("Ennemy") && collision.gameObject != null)
|
||||
{
|
||||
collision.GetComponent<Ennemy>().Life -= Damages;
|
||||
collision.GetComponent<Ennemy>().Life -= _manager.SwordsDamages;
|
||||
collision.gameObject.GetComponent<Ennemy>().AnimateHit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: eb7d27bb22bd0cb4aaa180bffb894086, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Damages: 25
|
||||
--- !u!61 &5490123958980842494
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -145,7 +146,7 @@ BoxCollider2D:
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_Bits: 63
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
|
||||
@@ -5,14 +5,32 @@ using UnityEngine;
|
||||
[RequireComponent (typeof(BoxCollider2D))]
|
||||
public class LaserBeam : MonoBehaviour
|
||||
{
|
||||
public int Damages = 50;
|
||||
|
||||
public float lifeSeconds = .2f;
|
||||
private PlayerManager _manager;
|
||||
private PlayerMovements _movements;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_manager = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerManager>();
|
||||
_movements = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovements>();
|
||||
if (_manager.BeamFrequency > 0)
|
||||
{
|
||||
StartCoroutine(nameof(EndLifeAfterXSeconds));
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_manager.laserOnX == 0)
|
||||
{
|
||||
if (!_movements.lookOnRight)
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0f, 180f, 0f);
|
||||
} else
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0f, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
@@ -26,13 +44,13 @@ public class LaserBeam : MonoBehaviour
|
||||
{
|
||||
if (collision.CompareTag("Ennemy"))
|
||||
{
|
||||
collision.gameObject.GetComponent<Ennemy>().Life -= (int)(Damages * Time.deltaTime);
|
||||
collision.gameObject.GetComponent<Ennemy>().Life -= (int)(_manager.BeamDamages * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator EndLifeAfterXSeconds()
|
||||
{
|
||||
yield return new WaitForSeconds(lifeSeconds);
|
||||
yield return new WaitForSeconds(_manager.BeamLife);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ SpriteRenderer:
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: -1
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
@@ -97,7 +97,7 @@ GameObject:
|
||||
- component: {fileID: 1475843655422961594}
|
||||
m_Layer: 0
|
||||
m_Name: Laser Beam
|
||||
m_TagString: Untagged
|
||||
m_TagString: Beam
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@@ -133,7 +133,7 @@ BoxCollider2D:
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_Bits: 63
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
@@ -175,4 +175,3 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 85af5326636cca14082a8bc4f4dfedcc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Damages: 50
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"MonoBehaviour": {
|
||||
"Version": 4,
|
||||
"EnableBurstCompilation": true,
|
||||
"EnableOptimisations": true,
|
||||
"EnableSafetyChecks": false,
|
||||
"EnableDebugInAllBuilds": false,
|
||||
"DebugDataKind": 1,
|
||||
"EnableArmv9SecurityFeatures": false,
|
||||
"CpuMinTargetX32": 0,
|
||||
"CpuMaxTargetX32": 0,
|
||||
"CpuMinTargetX64": 0,
|
||||
"CpuMaxTargetX64": 0,
|
||||
"CpuTargetsX32": 6,
|
||||
"CpuTargetsX64": 72,
|
||||
"OptimizeFor": 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"MonoBehaviour": {
|
||||
"Version": 4,
|
||||
"DisabledWarnings": ""
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ PlayerSettings:
|
||||
usePlayerLog: 1
|
||||
dedicatedServerOptimizations: 0
|
||||
bakeCollisionMeshes: 0
|
||||
forceSingleInstance: 0
|
||||
forceSingleInstance: 1
|
||||
useFlipModelSwapchain: 1
|
||||
resizableWindow: 0
|
||||
useMacAppStoreValidation: 0
|
||||
|
||||
@@ -6,6 +6,7 @@ TagManager:
|
||||
tags:
|
||||
- Orb
|
||||
- Ennemy
|
||||
- Beam
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Reference in New Issue
Block a user