public virtual void UpdateState(GameElementData elementData) { if (currentState != null) { currentState.Update(elementData); } }
public virtual void UpdateState(UserInput userInput, GameElementData elementData) { if (currentState != null) { currentState.Update(userInput, elementData); } }
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(); } }
public virtual void TransitionToNextState(GameElementData elementData) { if (currentState != null) { if (currentState.nextState != null) { currentState.nextState.OnEnter(elementData); currentState = currentState.nextState; currentState.nextState = null; } } }
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); } } }
public override void Update(UserInput userInput, GameElementData elementData) { nextState = new Runner_NormalRun(); }
public override void Init() { elementData = new GameElementData(this.transform); stateController = new StateController(new Runner_Idle(), elementData); }
private void Start() { elementData = new GameElementData(this.transform); }
public virtual void Update(UserInput userInput, GameElementData elementData) { }
public virtual void Update(GameElementData elementData) { }
public virtual void OnEnter(GameElementData elementData) { }
public override void OnEnter(GameElementData elementData) { elementData.verticalVelocity = StaticRefs.gameData.RunnerVerticalVelocity; }
public override void OnEnter(GameElementData elementData) { elementData.horizontalVelocity = StaticRefs.gameData.RunnerHorizontalVelocity; }
public StateController(State initialState, GameElementData data) { currentState = initialState; currentState.OnEnter(data); }
public override void Update(GameElementData elementData) { }
public override void OnEnter(GameElementData elementData) { elementData.elementTransform.position = new Vector3(15f, 0f, 0f); }
public override void OnEnter(GameElementData elementData) { elementData.verticalVelocity = 0; }