public static SkillsSuper SelectSkill(ActorSuper actor) { if (actor.skills.Length == 1) { return(actor.skills[0]); } if (actor is GoblinWarrior) { Debug.Log("Warrior"); return(actor.skills[0]); } return(actor.skills[0]); }
// All combat decisions for the enemy to attack the player private void EnemyAction() { ActorSuper actor = activePlayer.GetComponent <ActorSuper>(); //select action to take SkillsSuper skill = AI.SelectSkill(actor); // select target for enemy GameObject enemy_target = AI.FindTarget(skill, gm.party, enemies); // skill will be null if (skill != null) { skill.SkillAction(enemy_target); } }
// find target with minimum health, attack that target private static GameObject GangUp(GameObject[] oppositeTeam) { // default to target 1st opposite team member GameObject target = oppositeTeam[0]; float min = 0; foreach (GameObject g in oppositeTeam) { ActorSuper actor = g.GetComponent <ActorSuper>(); float temp = actor.GetHealth(); if (temp < min) { min = temp; target = g; } } return(target); }