Esempio n. 1
0
        // TouchKit Input
        private void TouchKitInput()
        {
            if (TCKInput.CheckController(actions.pause) && TCKInput.GetAction(actions.pause, TCKActionEvent.Down))
            {
                Pause();
            }

            runAction = (TCKInput.CheckController(actions.run) && TCKInput.GetAction(actions.run, TCKActionEvent.Press));

            if (TCKInput.CheckController(actions.jump) && TCKInput.GetAction(actions.jump, TCKActionEvent.Down))
            {
                FirstPersonController.Jump();
            }
            if (TCKInput.CheckController(actions.crouch) && TCKInput.GetAction(actions.crouch, TCKActionEvent.Down))
            {
                FirstPersonController.Crouch();
            }

            if (TCKInput.CheckController(actions.use) && TCKInput.GetAction(actions.use, TCKActionEvent.Down))
            {
                PlayerCamera.UseItem();
            }

            if (TCKInput.CheckController(actions.reloadWeapon) && TCKInput.GetAction(actions.reloadWeapon, TCKActionEvent.Down))
            {
                WeaponsManager.ReloadWeapon();
            }
            if (TCKInput.CheckController(actions.nextFiremode) && TCKInput.GetAction(actions.nextFiremode, TCKActionEvent.Down))
            {
                WeaponsManager.SwitchFiremode();
            }
            if (TCKInput.CheckController(actions.nextAmmotype) && TCKInput.GetAction(actions.nextAmmotype, TCKActionEvent.Down))
            {
                WeaponsManager.SwitchAmmotype();
            }
            if (TCKInput.CheckController(actions.toSubweapon) && TCKInput.GetAction(actions.toSubweapon, TCKActionEvent.Down))
            {
                WeaponsManager.SwitchToSubWeapon();
            }
            if (TCKInput.CheckController(actions.dropWeapon) && TCKInput.GetAction(actions.dropWeapon, TCKActionEvent.Down))
            {
                WeaponsManager.DropCurrentWeapon();
            }
            if (TCKInput.CheckController(actions.prevWeapon) && TCKInput.GetAction(actions.prevWeapon, TCKActionEvent.Down))
            {
                WeaponsManager.SelectPreviousWeapon();
            }
            if (TCKInput.CheckController(actions.nextWeapon) && TCKInput.GetAction(actions.nextWeapon, TCKActionEvent.Down))
            {
                WeaponsManager.SelectNextWeapon();
            }


            if (TCKInput.CheckController(axes.moveJoystick))
            {
                moveHorizontal = Mathf.Clamp(TCKInput.GetAxis(axes.moveJoystick, TCKAxisType.Horizontal), -1f, 1f);
                moveVertical   = runAction ? 1f : Mathf.Clamp(TCKInput.GetAxis(axes.moveJoystick, TCKAxisType.Vertical), -1f, 1f);
            }

            if (TCKInput.CheckController(axes.lookTouchpad))
            {
                lookHorizontal = TCKInput.GetAxis(axes.lookTouchpad, TCKAxisType.Horizontal) * GameSettings.GetLookSensitivityByInvert_X;
                lookVertical   = TCKInput.GetAxis(axes.lookTouchpad, TCKAxisType.Vertical) * GameSettings.GetLookSensitivityByInvert_Y;
            }

            if (TCKInput.CheckController(actions.zoom))
            {
                zoomAction     = TCKInput.GetAction(actions.zoom, TCKActionEvent.Press);
                zoomActionDown = TCKInput.GetAction(actions.zoom, TCKActionEvent.Down);
                zoomActionUp   = TCKInput.GetAction(actions.zoom, TCKActionEvent.Up);
            }

            if (TCKInput.CheckController(actions.fire))
            {
                bool fireAction = TCKInput.GetAction(actions.fire, TCKActionEvent.Press);
                // Fire and Reset Weapon
                if (fireAction && !FirstPersonController.isRunning)
                {
                    WeaponsManager.WeaponFire();
                }
                else
                {
                    WeaponsManager.WeaponReset();
                }
            }
        }