/// <summary> /// Play the slide effect. /// </summary> public override IEnumerator Play() { control = GetComponent<GUIControl>(); if (control == null) yield break; control.visible = false; Rect rect = control.scaledRect.GetPixelRect(); float startTime = DialogueTime.time; float endTime = startTime + duration; while (DialogueTime.time < endTime) { float elapsed = DialogueTime.time - startTime; float progress = Mathf.Clamp(elapsed / duration, 0, 1); switch (direction) { case SlideDirection.FromBottom: control.Offset = new Vector2(0, (1 - progress) * (Screen.height - rect.y)); break; case SlideDirection.FromTop: control.Offset = new Vector2(0, -(1 - progress) * (rect.y + rect.height)); break; case SlideDirection.FromLeft: control.Offset = new Vector2(-(1 - progress) * (rect.x + rect.width), 0); break; case SlideDirection.FromRight: control.Offset = new Vector2((1 - progress) * (Screen.width - rect.x), 0); break; } control.visible = true; control.Refresh(); yield return null; } control.Offset = Vector2.zero; control.visible = true; control.Refresh(); }
private static void CheckSlideEffect(GUIControl control) { SlideEffect slideEffect = control.GetComponent<SlideEffect>(); if (slideEffect != null) { if (slideEffect.trigger == GUIEffectTrigger.OnEnable) { control.visible = false; } } }
/// <summary> /// Plays the flash effect. /// </summary> public override IEnumerator Play() { control = GetComponent<GUIControl>(); if (control == null) yield break; control.visible = true; while (true) { yield return new WaitForSeconds(interval); control.visible = !control.visible; } }
/// <summary> /// Sets a Unity GUI control active. /// </summary> /// <param name='control'> /// Control to set. /// </param> /// <param name='value'> /// <c>true</c> for active; <c>false</c> for inactive. /// </param> public static void SetControlActive(GUIControl control, bool value) { if (control != null) { if ((value == true) && !control.gameObject.activeSelf) { control.gameObject.SetActive(true); CheckSlideEffect(control); } else if ((value == false) && control.gameObject.activeSelf) { control.gameObject.SetActive(false); } } }
public UnityQTEControls(GUIControl[] qteIndicators) { this.qteIndicators = qteIndicators; }
private bool IsClickableButton(GUIControl control) { return((control != null) && control.visible && (control is GUIButton) && (control as GUIButton).clickable); }
public void Awake() { control = GetComponent<GUIControl>(); if (control == null) control = gameObject.AddComponent<GUIControl>(); control.visible = false; }
private float GetChildXMax(GUIControl child) { return(child.rect.xMax); }
private void UpdateLayoutChild(GUIControl child, Vector2 childWindowSize) { child.Refresh(childWindowSize); child.dRect = clipChildren ? Vector2.zero : new Vector2(rect.x, rect.y); child.UpdateLayout(); //---Was (replaced by dRect above): if (!clipChildren) child.rect = new Rect(child.rect.x + rect.x, child.rect.y + rect.y, child.rect.width, child.rect.height); }