Exemple #1
0
        private void Awake() {
            var clearWhite = new Color(1, 1, 1, 0);

            HeldButtonUi.AddTo(this.menuNewSessionButtonImage, Inputs.PrimaryButton);
            HeldButtonUi.AddTo(this.menuExitGameButtonImage, Inputs.ExitButton);

            FloatTarget.AddTo(this.gameObject,
                v => {
                    this._currentRotation = v;
                    this.transform.eulerAngles = new Vector3(0, v, 0);
                },
                () => this._currentRotation,
                () => this._targetRotation, 7, TargetCurve.Easing);

            // Fade entire canvas in and out.
            this.headerText.color = clearWhite;
            this.resultsText.color = clearWhite;
            this.menuNewSessionText.color = clearWhite;
            this.menuExitGameText.color = clearWhite;
            this.instructionsText.color = clearWhite;
            ColorTarget.AddToTextGUIColor(this.headerText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.resultsText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.menuNewSessionText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.menuExitGameText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.instructionsText, this.ActiveColor);

            this.SetVisible(false);
        }
Exemple #2
0
        private void Awake()
        {
            HeldButtonUi.AddTo(this.releaseButtonImage, Inputs.SecondaryButton);

            FloatTarget.AddTo(this.gameObject, v => {
                this._currentAngle         = v;
                this.transform.eulerAngles = new Vector3(0, v, 0);
            },
                              () => this._currentAngle,
                              () => this._currentAngleTarget, 5f, TargetCurve.Easing);
        }
Exemple #3
0
        public static HeldButtonUi AddTo(Image image, HeldInput heldInput)
        {
            image.fillAmount           = 0;
            image.transform.localScale = Vector3.zero;
            var result = image.gameObject.AddComponent <HeldButtonUi>();

            result._heldInput = heldInput;
            FloatTarget.AddToImageFillAmount(image,
                                             () => result.IsActive
                    ? Mathf.Max(0, heldInput.ProportionDown * (1 + result.MinHoldProportion) - result.MinHoldProportion)
                    : 0,
                                             3);
            Vector3Target.AddToLocalScale(image.gameObject,
                                          () => result.IsActive && heldInput.IsDown ? Vector3.one : Vector3.zero, 5, TargetCurve.Easing);
            return(result);
        }
Exemple #4
0
        private void Awake()
        {
            for (var i = 0; i < this.textMeshes.Length; i++)
            {
                var textMesh = this.textMeshes[i];
                var index    = i;
                ColorTarget.AddToTextGUIColor(textMesh,
                                              () => new Color(1, 1, 1,
                                                              this._showMeshArray != null && this._showMeshArray.Length > index && this._showMeshArray[index]
                            ? 1f
                            : 0f),
                                              NormalSpeed);
            }

            FloatTarget.AddTo(this.gameObject, v => {
                this._currentAngle         = v;
                this.transform.eulerAngles = new Vector3(0, this._currentAngle, 0);
            },
                              () => this._currentAngle,
                              () => this._currentAngleTarget, 1f, TargetCurve.Easing);
        }