Beispiel #1
0
 /// <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;
     }
 }
Beispiel #2
0
 /// <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();
     }
 }
Beispiel #3
0
 /// <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);
 }
Beispiel #4
0
 /// <summary>
 /// On agent is being forced to reach its destination
 /// </summary>
 public virtual void OnForced()
 {
     enemy = null;
 }