protected void Awake() { // Set animator _animator = GetComponentInChildren <Animator>(); // Set action planner _actionPlanner = new ActionPlanner <Dog, IDogAction>(); // Set state _state = _actionPlanner.GetState(); _state.Position = new Vector2(_animator.transform.position.x, _animator.transform.position.z); _state.Speed = new Vector2(0, 0); // Set active plan _planActive = _actionPlanner.GetPlan(); // Set test plan _planTest = _actionPlanner.GetPlan(); // Set action state machine _actionStateMachine = new ActionStateMachine <Dog, IDogAction, float>(); }
public Move(GameObject gameObject, IReadOnlyList <IDogActionMovement> actionsMovement, IDogActionDestination actionDestination) { // Set action planner _actionPlanner = new ActionPlanner <Dog, IDogActionMovement>(); // Set action state machine _actionStateMachine = new ActionStateMachine <Dog, IDogActionMovement, float>(); // Run through movement actions for (int i = 0; i < actionsMovement.Count; i++) { // Create movement action var actionMovement = actionsMovement[i].Create(gameObject, actionDestination); // Add movement action _actionPlanner.AddAction(actionMovement); } // Set destination action _actionDestination = actionDestination; // Get plan _plan = _actionPlanner.GetPlan(); // Set plan _actionPlanner.PopulatePlan(_plan, _actionPlanner.Actions[0]); }