Esempio n. 1
0
 public void Attack()
 {
     if (enemy.returnElapsedTime() > enemy.wpnSpeed && enemy.inCombat)
     {
         if (enemy.returnTarget().GetComponent <Ally_Melee> () != null)
         {
             if (enemy.returnTarget().GetComponent <Ally_Melee> ().ally.isAlive())
             {
                 enemy.returnTarget().GetComponent <Ally_Melee> ().ally.takeDamage(enemy.wpnDmg);
             }
             else
             {
                 enemy.nullTarget();
                 enemy.GetTarget();
             }
         }
         else if (enemy.returnTarget().GetComponent <Ally_Ranged> () != null)
         {
             if (enemy.returnTarget().GetComponent <Ally_Ranged> ().ally.isAlive())
             {
                 enemy.returnTarget().GetComponent <Ally_Ranged> ().ally.takeDamage(enemy.wpnDmg);
             }
             else
             {
                 enemy.nullTarget();
                 enemy.GetTarget();
             }
         }
         else if (enemy.returnTarget().GetComponent <Player> () != null)
         {
             if (enemy.returnTarget().GetComponent <Player> ().isAlive())
             {
                 enemy.returnTarget().GetComponent <Player> ().takeDamage(enemy.wpnDmg);
             }
             else
             {
                 enemy.nullTarget();
                 enemy.GetTarget();
             }
         }
         enemy.setElapsedTime(0);
     }
     enemy.incElapsedTime();
 }