Exemplo n.º 1
0
    private void FightClosestTarget()
    {
        TargetableByAIEnemy closestTargetEnemy = AI_ControllerEnemy.Instance.GetClosestTargetEnemy(transform.position);

        if (closestTargetEnemy != null)
        {
            charController.Command_AttackMelee(closestTargetEnemy.GetComponent <Alive> ());
        }
    }
Exemplo n.º 2
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();
        }
    }
Exemplo n.º 3
0
    void OnGotHit(Fighter attacker)
    {
        Alive attackersAlive = attacker.GetComponent <Alive>();

        if (!charController.CommandIssued && !attackersAlive.IsDead)
        {
            charController.Command_AttackMelee(attackersAlive);
        }
    }
Exemplo n.º 4
0
 public void SetTarget(Alive target)
 {
     if (selectedCharacter != null)
     {
         selectedCharacter.Command_AttackMelee(target);
         target.SendMessage("OnTargeted", SendMessageOptions.DontRequireReceiver);
         currentlyTargetedChar = true;
         UnSeletedCharacter();
     }
 }