예제 #1
0
    private void FightClosestTarget()
    {
        TargetableByAIAlly closestTargetAlly = AI_ControllerAlly.Instance.GetClosestTargetAlly(transform.position, soldierType.GetSoldierType);

        if (closestTargetAlly != null)
        {
            if (soldierType.melee)
            {
                charController.Command_AttackMelee(closestTargetAlly.GetComponent <Alive> ());
            }
            else if (soldierType.range)
            {
                charController.Command_AttackRange(closestTargetAlly.GetComponent <Alive> ());
            }
            else if (soldierType.magic)
            {
                charController.Command_AttackMagic(closestTargetAlly.GetComponent <Alive> ());
            }
            else
            {
                Debug.Log("Pas de type de combattant indiqué");
            }
        }
        else if (walker.IsInRallyPoint)
        {
            new WaitForSeconds(3f);
            StartCoroutine("Fight");
        }
        else
        {
            // Debug.Log (walker.IsInRallyPoint);
            charController.OnWalkToRallyPoint();
        }
    }