diff --git a/theProject/Assets/Scripts/Soldier.cs b/theProject/Assets/Scripts/Soldier.cs index d611ae63..dbeba977 100644 --- a/theProject/Assets/Scripts/Soldier.cs +++ b/theProject/Assets/Scripts/Soldier.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; +using UnityEngine.Events; public class Soldier : MonoBehaviour { @@ -43,10 +44,8 @@ public class Soldier : MonoBehaviour { Ally, Enemy - } - [SerializeField] private Soldier target; - [SerializeField] private SoldierType enemyType; - [SerializeField] private SoldierType ourType; + } + [Header("Values")] [SerializeField] private float maxHealthPoints = 10; [SerializeField] private float healthPoints = 1; [SerializeField] private float rangeAttack = 100; @@ -54,12 +53,20 @@ public class Soldier : MonoBehaviour [SerializeField] private float damageAttack = 1; [SerializeField] private int speedAttack = 1; // ticks between attacks [SerializeField] private int lastAttackTick = -1; - + [Header("References")] [SerializeField] private TMP_Text nameText = null; [SerializeField] private TMP_Text healthPointsText = null; + [Header("Do-not-change-in-game values")] + [SerializeField] private Soldier target; + [SerializeField] private SoldierType enemyType; + [SerializeField] private SoldierType ourType; [SerializeField] private Vector2Int movementDestination = Vector2Int.zero; + // variables not visible in inspector + + [HideInInspector] public UnityEvent onDeath = new UnityEvent(); + public SoldierType TempGetOwnType() { return ourType; @@ -109,6 +116,7 @@ public class Soldier : MonoBehaviour private void OnDestroy() { TickSystem.OnTick -= HandleTick; + onDeath.Invoke(); Debug.Log("Soldier: " + ourType.ToString() + " has died", gameObject); }