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]); }
public override IDogActionMovement Create(GameObject gameObject, IDogActionDestination actionDestination) { // Create walk var walk = gameObject.AddComponent <UWalk>(); // Set serialize fields walk._transitionTime = _transitionTime; walk._speedMaximum = _speedMaximum; walk._speedMinimum = _speedMinimum; walk._speedAcceleration = _speedAcceleration; walk._distanceSlow = _distanceSlow; // Set destination action walk._actionDestination = actionDestination; // Set animators walk._walk = _walk; walk._speed = _speed; // Initialize walk walk.Initialize(Controls); // Return walk return(walk); }
public abstract IDogActionMovement Create(GameObject gameObject, IDogActionDestination actionDestination);