protected IEnumerator Check_Priorities() { if (goal_list.Count <= 0) { next_state = Search_For_Goal(); } else { float highest_priority = 0.0f; Priority_Goal temp_goal = new Priority_Goal(); foreach (var goal in goal_list) { if (goal.priority > highest_priority) { temp_goal = goal; } } if (temp_goal.start_routine == null) { next_state = Move_To_Goal(temp_goal.destination, !temp_goal.do_touch); } else { next_state = temp_goal.start_routine; } } yield return(null); }
protected void Create_Goal(Vector3Int i_pos, float i_priority, bool i_do_touch, IEnumerator i_routine) { Priority_Goal temp_goal = new Priority_Goal(); temp_goal.destination = i_pos; temp_goal.priority = i_priority; temp_goal.do_touch = i_do_touch; temp_goal.completion_routine = i_routine; goal_list.Add(temp_goal); }