//-------------------------------------------------------------------- // アクション遷移判定式 //-------------------------------------------------------------------- public bool CanNeutral() { if (Utility.StickLXSlople() > 0.0f) { return(false); } ActionStateMachine.ChangeState(new Neutral()); return(true); }
public bool CanRun() { if (Utility.StickLXSlople() < mRunLowerLim || mRunUpperLim < Utility.StickLXSlople()) { return(false); } ActionStateMachine.ChangeState(new Run()); return(true); }
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]); }
//-------------------------------------------------------------------- // 更新 //-------------------------------------------------------------------- private void Update() { Debug.Log(Input.GetAxisRaw("StickL X")); ActionStateMachine.Update(this); }
void Awake() { _actionStateMachine = GetComponent <ActionStateMachine>(); }