Example #1
0
 /*Applies aggro to whoever damage the AIController.Assumes that
  * the target is a cpu.*/
 void ApplyAggro(int damage, UnitHealthDefence Target)
 {
     /*This distinction is made,for players' guns aren't children for the sake
      * of manual position syncing in multiplayer.*/
     if (Target)
     {
         AIController AI = Target.GetComponentInChildren <AIController>();
         if (AI)
         {
             NetworkInstanceId ID;
             if (gun_reference.client_user)
             {
                 ID = gun_reference.client_user.netId;
             }
             else
             {
                 NetworkBehaviour pnb = gun_reference.transform.parent.GetComponent <NetworkBehaviour>();
                 ID = pnb.netId;
                 AIController aAI = pnb.GetComponentInChildren <AIController>();
             }
             AI.UpdateAggro(damage, ID);
         }
     }
 }