/// <summary> /// Awake the instance . /// </summary> private void Awake() { //set single tone. if (ModelControlReference == null) { ModelControlReference = this; } //set up view. _currentViewStatus = defaultView; //Set up current model. _currentModel = defaultModel; //Activate view ActivateView(defaultView); }
/// <summary> /// Activate view. /// </summary> public void ActivateView(ModelViewStatus status) { //Already playing . if (_currentViewStatus == status) { return; } //change status. _currentViewStatus = status; //Get the both model. if (maleModel.activeInHierarchy) { maleModel.SetActive(false); } if (femaleModel.activeInHierarchy) { femaleModel.SetActive(false); } //Switch switch (status) { case ModelViewStatus.SingleView: //set up single view . SingleViewModelSetup(); //Activate ActivateModel(_currentModel); break; case ModelViewStatus.SideBySideView: //set up side view . SideBySideViewSetup(); //Activate both model. if (!maleModel.activeInHierarchy) { maleModel.SetActive(true); } if (!femaleModel.activeInHierarchy) { femaleModel.SetActive(true); } break; default: throw new ArgumentOutOfRangeException("status", status, null); } }