void EnterState(BallState NewState) { if (NewState != null) { CurrentState.Exit(); NewState.Enter(this); CurrentState = NewState; } }
// Use this for initialization void OnEnable() { _mesh = GetComponent <MeshRenderer>(); _mat = _mesh.material; CurrentState = new GrowState { GrowRate = .1f }; CurrentState.Enter(this); }
public void ChangeState(BallState newState) { CurrentState.Exit(); CurrentState = newState; CurrentState.Enter(); }
public void Initialize(BallState startingState) { CurrentState = startingState; CurrentState.Enter(); }