private void FightClosestTarget() { TargetableByAIEnemy closestTargetEnemy = AI_ControllerEnemy.Instance.GetClosestTargetEnemy(transform.position); if (closestTargetEnemy != null) { charController.Command_AttackMelee(closestTargetEnemy.GetComponent <Alive> ()); } }
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(); } }
void OnGotHit(Fighter attacker) { Alive attackersAlive = attacker.GetComponent <Alive>(); if (!charController.CommandIssued && !attackersAlive.IsDead) { charController.Command_AttackMelee(attackersAlive); } }
public void SetTarget(Alive target) { if (selectedCharacter != null) { selectedCharacter.Command_AttackMelee(target); target.SendMessage("OnTargeted", SendMessageOptions.DontRequireReceiver); currentlyTargetedChar = true; UnSeletedCharacter(); } }