Exemplo n.º 1
0
        private void Setup(QTEType _qteType, string _inputName, float _duration, Animator _animator, bool _wrongKeyFails, float _axisThreshold)
        {
            qteType  = _qteType;
            qteState = QTEState.None;

            progress      = 0f;
            inputName     = _inputName;
            animator      = _animator;
            wrongKeyFails = _wrongKeyFails;
            numPresses    = 0;
            startTime     = Time.time;
            lastPressTime = 0f;
            endTime       = Time.time + _duration;
            axisThreshold = _axisThreshold;
        }
Exemplo n.º 2
0
        protected void Setup(QTEType _qteType, string _inputName, float _duration, Animator _animator, bool _wrongKeyFails, float _axisThreshold)
        {
            qteType  = _qteType;
            qteState = QTEState.None;

            progress      = 0f;
            inputName     = _inputName;
            animator      = _animator;
            wrongKeyFails = _wrongKeyFails;
            numPresses    = 0;
            startTime     = Time.time;
            lastPressTime = 0f;
            endTime       = Time.time + _duration;
            axisThreshold = _axisThreshold;

            KickStarter.eventManager.Call_OnQTEBegin(qteType, inputName, _duration);
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            qteType = (QTEType)EditorGUILayout.EnumPopup("QTE type:", qteType);

            string _label = (qteType == QTEType.SingleAxis) ? "axis" : "button";

            inputNameParameterID = Action.ChooseParameterGUI("Input " + _label + " name:", parameters, inputNameParameterID, ParameterType.String);
            if (inputNameParameterID < 0)
            {
                inputName = EditorGUILayout.TextField("Input " + _label + " name:", inputName);
            }

            if (qteType == QTEType.SingleAxis)
            {
                axisThreshold = EditorGUILayout.Slider("Axis threshold:", axisThreshold, -1f, 1f);

                if (axisThreshold >= 0f)
                {
                    _label = "Negative axis fails?";
                }
                else if (axisThreshold < 0f)
                {
                    _label = "Positive axis fails?";
                }

                if (Mathf.Approximately(axisThreshold, 0f))
                {
                    EditorGUILayout.HelpBox("The 'Axis threshold' cannot be zero.", MessageType.Warning);
                }
                else if (axisThreshold > 0f)
                {
                    EditorGUILayout.HelpBox("The QTE will be succesful when the input value is greater than the 'Axis threshold'.", MessageType.Info);
                }
                else if (axisThreshold < 0f)
                {
                    EditorGUILayout.HelpBox("The QTE will be succesful when the input value is less than than the 'Axis threshold'.", MessageType.Info);
                }
            }
            else
            {
                _label = "Wrong button fails?";

                if (KickStarter.settingsManager != null && KickStarter.settingsManager.inputMethod == InputMethod.TouchScreen)
                {
                    EditorGUILayout.HelpBox("If the input name field is left blank, then all screen taps will be valid.", MessageType.Info);
                }
            }

            wrongKeyFails = EditorGUILayout.Toggle(_label, wrongKeyFails);

            durationParameterID = Action.ChooseParameterGUI("Duration (s):", parameters, durationParameterID, ParameterType.Float);
            if (durationParameterID < 0)
            {
                duration = EditorGUILayout.Slider("Duration (s):", duration, 0f, 10f);
            }

            if (qteType == QTEType.ButtonMash)
            {
                targetPresses = EditorGUILayout.IntField("Target # of presses:", targetPresses);
                doCooldown    = EditorGUILayout.Toggle("Cooldown effect?", doCooldown);
                if (doCooldown)
                {
                    cooldownTime = EditorGUILayout.Slider("Cooldown time (s):", cooldownTime, 0f, duration);
                }
            }
            else if (qteType == QTEType.HoldKey)
            {
                holdDuration = EditorGUILayout.Slider("Required duration (s):", holdDuration, 0f, 10f);
            }

            menuNameParameterID = Action.ChooseParameterGUI("Menu to display (optional):", parameters, menuNameParameterID, ParameterType.String);
            if (menuNameParameterID < 0)
            {
                menuName = EditorGUILayout.TextField("Menu to display (optional):", menuName);
            }

            animateUI = EditorGUILayout.Toggle("Animate UI?", animateUI);

            if (animateUI)
            {
                if (qteType == QTEType.SingleKeypress || qteType == QTEType.SingleAxis)
                {
                    EditorGUILayout.HelpBox("The Menu's Canvas must have an Animator with 2 States: Win, Lose.", MessageType.Info);
                }
                else if (qteType == QTEType.ButtonMash)
                {
                    EditorGUILayout.HelpBox("The Menu's Canvas must have an Animator with 3 States: Hit, Win, Lose.", MessageType.Info);
                }
                else if (qteType == QTEType.HoldKey)
                {
                    EditorGUILayout.HelpBox("The Menu's Canvas must have an Animator with 2 States: Win, Lose, and 1 Trigger: Held.", MessageType.Info);
                }
            }
        }
Exemplo n.º 4
0
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            qteType = (QTEType) EditorGUILayout.EnumPopup ("QTE type:" , qteType);

            inputNameParameterID = Action.ChooseParameterGUI ("Button name:", parameters, inputNameParameterID, ParameterType.String);
            if (inputNameParameterID < 0)
            {
                inputName = EditorGUILayout.TextField ("Button name:", inputName);
            }
            wrongKeyFails = EditorGUILayout.Toggle ("Wrong key fails?", wrongKeyFails);

            durationParameterID = Action.ChooseParameterGUI ("Duration (s):", parameters, durationParameterID, ParameterType.Float);
            if (durationParameterID < 0)
            {
                duration = EditorGUILayout.Slider ("Duration (s):", duration, 0f, 10f);
            }

            if (qteType == QTEType.ButtonMash)
            {
                targetPresses = EditorGUILayout.IntField ("Target # of presses:", targetPresses);
                doCooldown = EditorGUILayout.Toggle ("Cooldown effect?", doCooldown);
                if (doCooldown)
                {
                    cooldownTime = EditorGUILayout.Slider ("Cooldown time (s):", cooldownTime, 0f, duration);
                }
            }
            else if (qteType == QTEType.HoldKey)
            {
                holdDuration = EditorGUILayout.Slider ("Required duration (s):", holdDuration, 0f, duration);
            }

            menuNameParameterID = Action.ChooseParameterGUI ("Menu to display (optional):", parameters, menuNameParameterID, ParameterType.String);
            if (menuNameParameterID < 0)
            {
                menuName = EditorGUILayout.TextField ("Menu to display (optional):", menuName);
            }

            animateUI = EditorGUILayout.Toggle ("Animate UI?", animateUI);

            if (animateUI)
            {
                if (qteType == QTEType.SingleKeypress)
                {
                    EditorGUILayout.HelpBox ("The Menu's Canvas must have an Animator with 2 States: Win, Lose.", MessageType.Info);
                }
                else if (qteType == QTEType.ButtonMash)
                {
                    EditorGUILayout.HelpBox ("The Menu's Canvas must have an Animator with 3 States: Hit, Win, Lose.", MessageType.Info);
                }
                else if (qteType == QTEType.HoldKey)
                {
                    EditorGUILayout.HelpBox ("The Menu's Canvas must have an Animator with 2 States: Win, Lose, and 1 Trigger: Held.", MessageType.Info);
                }
            }
        }
Exemplo n.º 5
0
        private void Setup(QTEType _qteType, string _inputName, float _duration, Animator _animator, bool _wrongKeyFails)
        {
            qteType = _qteType;
            qteState = QTEState.None;

            progress = 0f;
            inputName = _inputName;
            animator = _animator;
            wrongKeyFails = _wrongKeyFails;
            numPresses = 0;
            startTime = Time.time;
            lastPressTime = 0f;
            endTime = Time.time + _duration;
        }