protected void Start() { if (state == null) { //Start in wanderer state by default state = gameObject.GetComponent <WandererState>(); ChangeState(state); } bubbleText.text = number.ToString(); }
//Change current state and enable/disable appriopriate components? public void ChangeState(BubbleState newState) { if (state != null) { state.Deactivate(); state.enabled = false; } state = newState; state.enabled = true; newState.Activate(); }