예제 #1
0
 // ------------------
 void Update()
 {
     if (!string.IsNullOrEmpty(this.actionButonName) && CF2Input.GetButtonDown(this.actionButonName))
     {
         this.PerformAction();
     }
 }
예제 #2
0
        // ------------------
        public bool IsInEffect()
        {
            if ((this.mobileModeRelation != MobileModeRelation.AlwaysEnabled) &&
                (CF2Input.IsInMobileMode() ?
                 (this.mobileModeRelation == MobileModeRelation.DisabledInMobileMode) :
                 (this.mobileModeRelation == MobileModeRelation.EnabledOnlyInMobileMode)))
            {
                return(true);
            }

            if (this.rig == null)
            {
                return(false);
            }

            if (this.disableWhenTouchScreenInactive && this.rig.AreTouchControlsSleeping())
            {
                return(true);
            }
            if (this.disableWhenCursorIsUnlocked && !CFScreen.lockCursor)
            {
                return(true);
            }
            if (this.IsDisabledByRigSwitches())
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
        // ------------------
        void Update()
        {
            float axisVal = CF2Input.GetAxisRaw(this.axisName, ref this.axisId);
            int   axisDir = (Mathf.Abs(axisVal) > this.axisDeadzone) ? ((axisVal > 0) ? 1 : -1) : 0;


            switch (this.eventType)
            {
            case EventType.OnPress:
                if ((axisDir != 0) && (this.prevAxisDir != axisDir))
                {
                    ((axisDir > 0) ? this.positiveEvent : this.negativeEvent).Invoke();
                }
                break;

            case EventType.OnRelease:
                if ((this.prevAxisDir != 0) && (axisDir != this.prevAxisDir))
                {
                    ((this.prevAxisDir > 0) ? this.positiveEvent : this.negativeEvent).Invoke();
                }
                break;

            case EventType.WhenPressed:
                if ((axisDir != 0))
                {
                    ((axisDir > 0) ? this.positiveEvent : this.negativeEvent).Invoke();
                }
                break;
            }

            this.prevAxisDir = axisDir;
        }
        // -------------
        void Update()
        {
            if (this.character == null)
            {
                return;
            }


            if (CF2Input.GetButtonDown("Left-Stab"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.LEFT_STAB);
            }
            else if (CF2Input.GetButtonDown("Left-Slash-U"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.LEFT_SLASH_U);
            }
            else if (CF2Input.GetButtonDown("Left-Slash-R"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.LEFT_SLASH_R);
            }
            else if (CF2Input.GetButtonDown("Left-Slash-L"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.LEFT_SLASH_L);
            }
            else if (CF2Input.GetButtonDown("Left-Slash-D"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.LEFT_SLASH_D);
            }

            else if (CF2Input.GetButtonDown("Right-Stab"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.RIGHT_STAB);
            }
            else if (CF2Input.GetButtonDown("Right-Slash-U"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.RIGHT_SLASH_U);
            }
            else if (CF2Input.GetButtonDown("Right-Slash-R"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.RIGHT_SLASH_R);
            }
            else if (CF2Input.GetButtonDown("Right-Slash-L"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.RIGHT_SLASH_L);
            }
            else if (CF2Input.GetButtonDown("Right-Slash-D"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.RIGHT_SLASH_D);
            }

            else if (CF2Input.GetButtonDown("Dodge-Right"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.DODGE_RIGHT);
            }
            else if (CF2Input.GetButtonDown("Dodge-Left"))
            {
                this.character.ExecuteAction(SwipeSlasherChara.ActionType.DODGE_LEFT);
            }
        }
        // ------------------
        void Update()
        {
            if (!string.IsNullOrEmpty(this.camZoomDeltaAxis))
            {
                this.camZoomFactor += CF2Input.GetAxis(this.camZoomDeltaAxis);
            }

            this.camZoomFactor = Mathf.Clamp01(this.camZoomFactor);
        }
예제 #6
0
        // -----------------
        void Update()
        {
            bool triggerState =
                ((this.key != KeyCode.None) ? CF2Input.GetKey(this.key) : false) ||
                (!string.IsNullOrEmpty(this.buttonName) ? CF2Input.GetButton(this.buttonName) : false);

            for (int i = 0; i < this.gunList.Length; ++i)
            {
                Gun g = this.gunList[i];
                if (g != null)
                {
                    g.SetTriggerState(triggerState);
                }
            }
        }
예제 #7
0
        void Update()
        {
            if (Input.GetKeyDown(this.deltaResetKey))
            {
                this.unScroll     = Vector2.zero;
                this.cfScroll     = Vector2.zero;
                this.cfMouseDelta = Vector2.zero;
                this.unMouseDelta = Vector2.zero;
            }

            this.cfScroll += CF2Input.mouseScrollDelta;
            //this.cfScroll.y += CF2Input.GetAxis("Mouse Scroll Wheel Y");
            this.unScroll.x += Input.mouseScrollDelta.x;
            this.unScroll.y += Input.mouseScrollDelta.y;

            this.cfMouseDelta.x += CF2Input.GetAxis("Mouse X");
            this.cfMouseDelta.y += CF2Input.GetAxis("Mouse Y");

            this.unMouseDelta.x += GetUnityAxis("Mouse X");
            this.unMouseDelta.y += GetUnityAxis("Mouse Y");
        }
예제 #8
0
        // ------------------
        void Update()
        {
            bool
                invokeNow = false;

            switch (this.eventType)
            {
            case EventType.OnPress:
                invokeNow = CF2Input.GetKeyDown(this.keyCode); break;

            case EventType.OnRelease:
                invokeNow = CF2Input.GetKeyUp(this.keyCode); break;

            case EventType.WhenPressed:
                invokeNow = CF2Input.GetKey(this.keyCode); break;
            }

            if (invokeNow)
            {
                this.keyEvent.Invoke();
            }
        }
        // ------------------
        void Update()
        {
            bool
                invokeNow = false;

            switch (this.eventType)
            {
            case EventType.OnPress:
                invokeNow = CF2Input.GetButtonDown(this.buttonName, ref this.buttonId); break;

            case EventType.OnRelease:
                invokeNow = CF2Input.GetButtonUp(this.buttonName, ref this.buttonId); break;

            case EventType.WhenPressed:
                invokeNow = CF2Input.GetButton(this.buttonName, ref this.buttonId); break;
            }

            if (invokeNow)
            {
                this.buttonEvent.Invoke();
            }
        }
예제 #10
0
        void Update()
        {
            if (ControlFreak2.CF2Input.GetKeyDown(this.deltaResetKey))
            {
                this.unScroll     = Vector2.zero;
                this.cfScroll     = Vector2.zero;
                this.cfMouseDelta = Vector2.zero;
                this.unMouseDelta = Vector2.zero;
            }

            this.cfScroll += CF2Input.mouseScrollDelta;
            //this.cfScroll.y += CF2Input.GetAxis("Mouse Scroll Wheel Y");
            this.unScroll.x += ControlFreak2.CF2Input.mouseScrollDelta.x;
            this.unScroll.y += ControlFreak2.CF2Input.mouseScrollDelta.y;

            if (CF2Input.activeRig != null)
            {
                this.cfMouseDelta.x += CF2Input.GetAxis("Mouse X");
                this.cfMouseDelta.y += CF2Input.GetAxis("Mouse Y");
            }

            this.unMouseDelta.x += GetUnityAxis("Mouse X");
            this.unMouseDelta.y += GetUnityAxis("Mouse Y");
        }
예제 #11
0
        // -------------------
        protected override void OnUpdateState()
        {
            if ((this.helpBox != null) && !this.helpBox.IsRunning() && (this.helpKey != KeyCode.None) && CF2Input.GetKeyDown(this.helpKey))
            {
                this.ShowHelpBox();
            }

            base.OnUpdateState();
        }
예제 #12
0
파일: Hammer.cs 프로젝트: kijprivate/Hammer
    void Update()
    {
        if (CF2Input.GetButton("Click") && !LevelContainer.MenuHided)
        {
            StartCoroutine(CoroutineHideMenuAndStartGame());
        }

        if (CF2Input.GetButton("Click") && isHammerReady && LevelContainer.GameStarted)
        {
            if (Tutorial.active)
            {
                Tutorial.SetActive(false);
            }
            if (isMovingUp)
            {
                rotationZ           += data.rotationSpeed * Time.deltaTime;
                movingY             += verticalMoveSpeed * Time.deltaTime;
                myTransform.rotation = Quaternion.Euler(0f, 0f, rotationZ);
                myTransform.position = new Vector3(myTransform.position.x, movingY, myTransform.position.z);

                if (myTransform.rotation.z >= 0.60f)
                {
                    isMovingUp = false;
                }
            }
            else if (!isMovingUp)
            {
                rotationZ           -= data.rotationSpeed * Time.deltaTime;
                movingY             -= verticalMoveSpeed * Time.deltaTime;
                myTransform.rotation = Quaternion.Euler(0f, 0f, rotationZ);
                myTransform.position = new Vector3(myTransform.position.x, movingY, myTransform.position.z);

                if (myTransform.rotation.z <= 0f)
                {
                    isMovingUp = true;
                }
            }
        }

        if (CF2Input.GetButtonUp("Click") && isHammerReady && LevelContainer.GameStarted)
        {
            SetupStrength();
            ParticleSystem.Burst b = sparks.emission.GetBurst(0);
            b.count = strength * 20;
            sparks.emission.SetBurst(0, b);
            sparks.Play();
            PlayHitSound();
            SetupHammerPositionAfterHit();

            isHammerReady = false;

            EventManager.RaiseEventHammerHit();

            if (LevelContainer.GameOver)
            {
                return;
            }

            StartCoroutine(BackToPositionRoutine());
        }
    }
        // -----------------
        void Update()
        {
            // Get input...

            this.SetCameraRelativeInput(this.cameraTransform,
                                        (string.IsNullOrEmpty(this.moveHorzAxis) ? 0 : CF2Input.GetAxis(this.moveHorzAxis)),
                                        (string.IsNullOrEmpty(this.moveVertAxis) ? 0 : CF2Input.GetAxis(this.moveVertAxis)),
                                        (string.IsNullOrEmpty(this.aimHorzAxis) ? 0 : CF2Input.GetAxis(this.aimHorzAxis)),
                                        (string.IsNullOrEmpty(this.aimVertAxis) ? 0 : CF2Input.GetAxis(this.aimVertAxis)));
        }
예제 #14
0
 // ----------------
 public float GetAxis(string name)
 {
     return(CF2Input.GetAxis(name));
 }
예제 #15
0
 public bool GetButton(string name)
 {
     return(CF2Input.GetButton(name));
 }