protected virtual void ActivateMenuObject(MenuObjectsHandler toOpen) { _handler.SetState(false, false, null); toOpen.SetState(true, true, _handler); _mouseOvered = false; }
public void SetState(bool state, bool forward, MenuObjectsHandler sender) { _finishedTransitioning = false; // We need to stop all current coroutines to stop issues where // HideHandler cr hadn't finished making all the menus deactivate. StopAllCoroutines(); if (state) { ActivateThis(); if (gui) StartCoroutine(ToggleGui()); // We only want to save the one who activated the object // so if it's turned off, we shouldn't change it. if (forward) _activatedBy = sender; } else { StartCoroutine(HideHandler()); if (gui) gui.beingShown = false; } // Have to do it here as the gameobject may not yet be active. StartCoroutine(FinishTransition()); for (var i = 0; i < menuObjects.Length; i++) { var trans = state ? onPositions[i] : offPositions[i]; menuObjects[i].targetPosition = trans; // Set this to stop them being clickable menuObjects[i].transitioningOut = !state; } }
private void Awake() { _handler = GetComponent<MenuObjectsHandler>(); }
protected override void ActivateMenuObject( MenuObjectsHandler toOpen ) { // Overriding so we don't do anything on this call. }