void ChangeState(Piece piece = null) { //Default state if (state == 0) { StopAllCoroutines(); //Make sure delayeddesctivatemodels coroutine isn't running and won't turn the models off later ActivateModels(); gameObject.SendMessage("SplitObject"); cursor.ShowSphere(); state = 1; } //Splited State else if (state == 1) { if (piece == null) { piece = defaultPiece; } gameObject.SendMessage("FocusPiece"); visualHolder.RotationMode(); if (focuser != null && piece != null) { focuser.Focus(piece); } state = 2; } //Focused On Piece State else if (state == 2) { gameObject.SendMessage("LeaveFocus"); visualHolder.LeaveRotationMode(); state = 3; } //Splited State (return) else if (state == 3) { gameObject.SendMessage("UnsplitObject"); state = 0; //Back to starting state StartCoroutine(DelayedDesactivateModels()); //Hide unnescessary models } infoManager.OnStateChanged(); }