Compare commits
4 Commits
a20d05cc1c
...
77a3b7f3fc
Author | SHA1 | Date |
---|---|---|
Sveske Juice | 77a3b7f3fc | |
Sveske Juice | 504c967f45 | |
Sveske Juice | 4baa667b4e | |
Sveske Juice | ee61049de0 |
|
@ -10,6 +10,7 @@ public class EnemyCollection : ScriptableObject
|
|||
public struct EnemyInfo
|
||||
{
|
||||
public string name;
|
||||
public int damage;
|
||||
public float moveSpeed;
|
||||
public bool FlyPath;
|
||||
public float feetOffset;
|
||||
|
|
|
@ -98,7 +98,7 @@ public class EnemySpawnManager : MonoBehaviour
|
|||
EnemyInfo enemyInfo = enemyCollection.Enemies[group.enemyIndex];
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,16 @@ public class GameManager : MonoBehaviour
|
|||
health = startHealth;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
foreach (var go in GameObject.FindObjectsByType<GameObject>(FindObjectsSortMode.None))
|
||||
{
|
||||
if (go != null && go != this.gameObject)
|
||||
Destroy(go);
|
||||
}
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
MoneyManager.OnShopSelected += m_OnTowerShopSelected;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class WaypointPath : MonoBehaviour
|
|||
if (index + 1 >= Waypoints.Count)
|
||||
{
|
||||
Destroy(data.Entity.gameObject); // Destroy object when finish waypoints
|
||||
GameManager.Instance.health--;
|
||||
GameManager.Instance.health -= data.Damage;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -69,13 +69,15 @@ public class WaypointEntityData
|
|||
public Transform NextTargetPosition;
|
||||
public float MoveSpeed;
|
||||
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;
|
||||
MoveSpeed = moveSpeed;
|
||||
|
||||
// feet :P
|
||||
FeetOffset = feet;
|
||||
Damage = damage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ public class PlayerHealth : MonoBehaviour
|
|||
{
|
||||
gameOver.SetActive(true);
|
||||
yield return new WaitForSecondsRealtime(5f);
|
||||
GameManager.Instance.Reset();
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ public class SwitchScene : MonoBehaviour
|
|||
{
|
||||
public void SwitchToScene(string scene)
|
||||
{
|
||||
GameManager.Instance.Reset();
|
||||
SceneManager.LoadScene(scene);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue