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