private void Update() { if (Input.GetKeyDown(KeyCode.F)) { flipFlop.Invoke(); } }
/// <summary> /// Plays the Show or the Hide animation depending on the current StateType of the UI Element. If StateType is Show, it plays the Hide animation and vice-versa. /// </summary> /// <param name="initialStateIsShowing">Should the fist call set the UI Element to the StateType "hide"?</param> public void SwitchState(bool initialStateIsShowing = false) { if (flipFlop == null) { if (initialStateIsShowing) { flipFlop = new FlipFlop(Hide, Show); } flipFlop = new FlipFlop(Show, Hide); } flipFlop.Invoke(); }