Compare commits

...

2 Commits

Author SHA1 Message Date
Sveske Juice 4baa667b4e Merge remote-tracking branch 'refs/remotes/origin/main' 2024-04-21 14:04:50 +02:00
Sveske Juice ee61049de0 variable enemy damage 2024-04-21 14:04:42 +02:00
3 changed files with 6 additions and 3 deletions

View File

@ -10,6 +10,7 @@ public class EnemyCollection : ScriptableObject
public struct EnemyInfo public struct EnemyInfo
{ {
public string name; public string name;
public int damage;
public float moveSpeed; public float moveSpeed;
public bool FlyPath; public bool FlyPath;
public float feetOffset; public float feetOffset;

View File

@ -99,7 +99,7 @@ public class EnemySpawnManager : MonoBehaviour
EnemyInfo enemyInfo = enemyCollection.Enemies[group.enemyIndex]; EnemyInfo enemyInfo = enemyCollection.Enemies[group.enemyIndex];
GameObject spawned = Instantiate(enemyInfo.prefab); GameObject spawned = Instantiate(enemyInfo.prefab);
WaypointEntityData data = new WaypointEntityData(spawned.transform, enemyInfo.moveSpeed, enemyInfo.feetOffset); WaypointEntityData data = new WaypointEntityData(spawned.transform, enemyInfo.moveSpeed, enemyInfo.feetOffset, enemyInfo.damage);
if (enemyInfo.FlyPath) if (enemyInfo.FlyPath)
{ {

View File

@ -37,7 +37,7 @@ public class WaypointPath : MonoBehaviour
if (index + 1 >= Waypoints.Count) if (index + 1 >= Waypoints.Count)
{ {
Destroy(data.Entity.gameObject); // Destroy object when finish waypoints Destroy(data.Entity.gameObject); // Destroy object when finish waypoints
GameManager.Instance.health--; GameManager.Instance.health -= data.Damage;
} }
else else
{ {
@ -69,13 +69,15 @@ public class WaypointEntityData
public Transform NextTargetPosition; public Transform NextTargetPosition;
public float MoveSpeed; public float MoveSpeed;
public float FeetOffset; public float FeetOffset;
public int Damage;
public WaypointEntityData(Transform entity, float moveSpeed, float feet) public WaypointEntityData(Transform entity, float moveSpeed, float feet, int damage)
{ {
Entity = entity; Entity = entity;
MoveSpeed = moveSpeed; MoveSpeed = moveSpeed;
// feet :P // feet :P
FeetOffset = feet; FeetOffset = feet;
Damage = damage;
} }
} }