public virtual moveTemplate GetMove() { if (attack is null) { int moveIndex = Random.Range(0, moveContainer.moves.Length); attack = moveContainer.moves[moveIndex].GetComponent <moveTemplate>(); return(attack); } else { return(attack); } }
public virtual void GetRoute(CombatExecutor combatExecutor) { AStar router = ScriptableObject.CreateInstance <AStar>(); //Get Move moveTemplate move = GetMove(); if (move.targetType != moveTemplate.TargetType.None) { //Get Goals List <GameObject> possibleTargets = combatExecutor.getTargets(move.targetType); if (combatExecutor.Clip.GetComponent <FighterClass>().Dead) { possibleTargets.Remove(combatExecutor.Clip); } if (combatExecutor.Partner != null) { if (combatExecutor.Partner.GetComponent <FighterClass>().Dead) { possibleTargets.Remove(combatExecutor.Partner); } } List <Vector2Int> goalPos = new List <Vector2Int>(); List <GameObject> goalObjects = new List <GameObject>(); move.character = gameObject; (goalPos, goalObjects) = move.findGoals(possibleTargets); (Vector2Int newPos, FighterClass.CharacterPosition moveType, bool atGoal) = router.GetNextTile( this, pos, goalPos ); if (atGoal) { List <GameObject> selectedTargets = new List <GameObject>(); selectedTargets.Add(goalObjects[router.finalGoalIdx]); move.Activate(selectedTargets); } else { MoveCharacter((newPos.x - pos.x), (newPos.y - pos.y)); } } else { move.character = gameObject; move.Activate(new List <GameObject>()); } }