Beispiel #1
0
 public void Check4Hit()
 {
     if (isPlayer)
     {
         PlayerCombat playerCombat = transform.parent.GetComponent <PlayerCombat>();
         if (playerCombat != null)
         {
             playerCombat.CheckForHit();
         }
         else
         {
             Debug.LogError("No playerCombat component find on object" + transform.parent);
         }
     }
     else
     {
         EnemyAI AI = transform.parent.GetComponent <EnemyAI>();
         if (AI != null)
         {
             AI.CheckForHit();
         }
         else
         {
             Debug.Log("no enemy AI component found on gameObject" + transform.parent.name);
         }
     }
 }
Beispiel #2
0
 //check if something was hit
 public void Check4Hit()
 {
     //check if the player has hit something
     if (isplayer)
     {
         PlayerCombat playerCombat = transform.parent.GetComponent <PlayerCombat> ();
         if (playerCombat != null)
         {
             playerCombat.CheckForHit();
         }
         else
         {
             Debug.Log("no player combat component found on gameObject '" + transform.parent.name + "'.");
         }
     }
     else
     {
         //check if the enemy has hit something
         EnemyAI AI = transform.parent.GetComponent <EnemyAI>();
         if (AI != null)
         {
             AI.CheckForHit();
         }
         else
         {
             Debug.Log("no enemy AI component found on gameObject '" + transform.parent.name + "'.");
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// 检查是否有东西被击中
 /// </summary>
 public void Check4Hit()
 {
     //检查玩家是否击中了东西
     if (isPlayer)
     {
         PlayerCombat playerCombat = transform.parent.GetComponent <PlayerCombat>();
         if (playerCombat != null)
         {
             playerCombat.CheckForHit();
         }
         else
         {
             Debug.Log(transform.parent.name + "找不到PlayerCombat组件.");
         }
     }
     else
     {
         //检查AI是否击中
         EnemyAI enemyAI = transform.parent.GetComponent <EnemyAI>();
         if (enemyAI != null)
         {
             enemyAI.CheckForHit();
         }
         else
         {
             Debug.Log(transform.parent.name + "找不到EnemyAI组件.");
         }
     }
 }