private void FixedUpdate() { m_Status = CheckStatus(); if (m_Status != TankStatus.Normal) { if (CurrentCommand != null && !CurrentCommand.IsBlocking) { m_CommandQueue.Remove(CurrentCommand); } else if (CurrentCommand != null && CurrentCommand.IsRunning && CurrentCommand.IsFinished()) { m_CommandQueue.Remove(CurrentCommand); } } else if (CurrentCommand != null) { if (!CurrentCommand.IsRunning) // Execute the first command. { CurrentCommand.Execute(); } else if (CurrentCommand.IsFinished()) // Current command finished, switch to next. { m_CommandQueue.Remove(CurrentCommand); } } }