コード例 #1
0
 public virtual void UpdateState(GameElementData elementData)
 {
     if (currentState != null)
     {
         currentState.Update(elementData);
     }
 }
コード例 #2
0
 public virtual void UpdateState(UserInput userInput, GameElementData elementData)
 {
     if (currentState != null)
     {
         currentState.Update(userInput, elementData);
     }
 }
コード例 #3
0
 public override void Update(UserInput userInput, GameElementData elementData)
 {
     if (elementData.elementTransform.position.y > 0f)
     {
         elementData.verticalVelocity          -= 0.001f;
         elementData.elementTransform.position += new Vector3(elementData.horizontalVelocity, elementData.verticalVelocity, 0f);
     }
     else
     {
         nextState = new Runner_NormalRun();
     }
 }
コード例 #4
0
 public virtual void TransitionToNextState(GameElementData elementData)
 {
     if (currentState != null)
     {
         if (currentState.nextState != null)
         {
             currentState.nextState.OnEnter(elementData);
             currentState           = currentState.nextState;
             currentState.nextState = null;
         }
     }
 }
コード例 #5
0
 public override void Update(UserInput userInput, GameElementData elementData)
 {
     if (JumpIsTriggered(userInput))
     {
         nextState = new Runner_Jump_Up();
     }
     else
     {
         if (elementData.elementTransform != null)
         {
             elementData.elementTransform.position += new Vector3(elementData.horizontalVelocity, 0f, 0f);
         }
     }
 }
コード例 #6
0
 public override void Update(UserInput userInput, GameElementData elementData)
 {
     nextState = new Runner_NormalRun();
 }
コード例 #7
0
 public override void Init()
 {
     elementData     = new GameElementData(this.transform);
     stateController = new StateController(new Runner_Idle(), elementData);
 }
コード例 #8
0
 private void Start()
 {
     elementData = new GameElementData(this.transform);
 }
コード例 #9
0
 public virtual void Update(UserInput userInput, GameElementData elementData)
 {
 }
コード例 #10
0
 public virtual void Update(GameElementData elementData)
 {
 }
コード例 #11
0
 public virtual void OnEnter(GameElementData elementData)
 {
 }
コード例 #12
0
 public override void OnEnter(GameElementData elementData)
 {
     elementData.verticalVelocity = StaticRefs.gameData.RunnerVerticalVelocity;
 }
コード例 #13
0
 public override void OnEnter(GameElementData elementData)
 {
     elementData.horizontalVelocity = StaticRefs.gameData.RunnerHorizontalVelocity;
 }
コード例 #14
0
 public StateController(State initialState, GameElementData data)
 {
     currentState = initialState;
     currentState.OnEnter(data);
 }
コード例 #15
0
 public override void Update(GameElementData elementData)
 {
 }
コード例 #16
0
 public override void OnEnter(GameElementData elementData)
 {
     elementData.elementTransform.position = new Vector3(15f, 0f, 0f);
 }
コード例 #17
0
 public override void OnEnter(GameElementData elementData)
 {
     elementData.verticalVelocity = 0;
 }