コード例 #1
0
 private void OnMouseOverEnemy(EnemyAI enemy)
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (!player.WeaponSystem.IsInRange(enemy.transform.position))
         {
             if (movementCoroutine == null)
             {
                 currentTarget = enemy;
                 StartCoroutine(MoveInRange(enemy.transform, () => MoveToAttackEnemyCallback()));
             }
         }
         else
         {
             var health = enemy.GetComponent <Health>();
             if (health != null)
             {
                 player.WeaponSystem.TryAttack(health);
             }
         }
     }
     if (Input.GetMouseButtonDown(1))
     {
         if (movementCoroutine == null)
         {
             currentTarget = enemy;
             StartCoroutine(MoveInRange(enemy.transform, () => MoveToPowerAttackEnemyCallback()));
         }
         else
         {
             specialAbilities.TryPerformPowerAttack(enemy.Health);
         }
     }
 }