/// <summary> /// Invoke damage to enemy agent /// </summary> /// <param name="dmg">Damage amount</param> public virtual void InvokeDamage(float dmg) { if (Enemy != null) { if (Enemy.agentStats.HP <= 0) { enemy = null; return; } Enemy.agentStats.HP -= dmg * agentStats.DMGMultiplier; } }
/// <summary> /// Decide what to do with hit object by raycast /// </summary> /// <param name="obj">Hit object by raycast</param> void RayHitEvent(GameObject obj) { // Select one agent if (obj.tag == "playable" && selectionBox.sizeDelta == Vector2.zero) { RTSAgent agent = obj.GetComponent <RTSAgent>(); UnselectAllUnit(); selectedUnit.Add(agent); agent.Select(); } else { MoveUnit(); } }
/// <summary> /// Deselect one agent from selected agents /// </summary> /// <param name="agent">Agent ot deselect</param> public void DeselectAgent(RTSAgent agent) { agent.Unselect(); selectedUnit.Remove(agent); }
/// <summary> /// On agent is being forced to reach its destination /// </summary> public virtual void OnForced() { enemy = null; }