public void ReplaceState(DrivingState state) { if (state == null) { Debug.LogError ("Error: Attempting to replace driving state for car '" + m_car.name + "' with null state"); return; } if (m_states.Peek () != null) { m_states.Pop ().Exit (m_car); } m_states.Push (state); state.Enter (m_car); }
public void PushState(DrivingState state) { if (state == null) { Debug.LogError ("Error: Attempting to push null driving state onto car '" + m_car.name + "'"); return; } if (m_states.Peek () != null) { m_states.Peek ().Exit (m_car); } m_states.Push (state); state.Enter (m_car); }