GetKey() public static method

public static GetKey ( KeyCode key ) : bool
key KeyCode
return bool
コード例 #1
0
ファイル: JoystickInput.cs プロジェクト: yabos/SaveTheQueen
        private void UpdateButtonInput()
        {
            float value;

            for (int i = 0; i < buttonAxisInputList.Count; ++i)
            {
                ButtonAxisInput buttonAxisInput = buttonAxisInputList[i];
                value = Input.GetAxis(buttonAxisInput.axisName);
                if (value != 0.0f)
                {
                    if (value == -1.0f)
                    {
                        buttonInputFlags |= buttonAxisInput.negativeButton;
                    }
                    else if (value == 1.0f)
                    {
                        buttonInputFlags |= buttonAxisInput.positiveButton;
                    }
                }
            }

            for (int i = 0; i < buttonInputList.Count; ++i)
            {
                ButtonInput buttonInput = buttonInputList[i];
                if (UInput.GetKey(buttonInput.keyCode))
                {
                    buttonInputFlags |= buttonInput.button;
                }
            }
        }
コード例 #2
0
 public float GetAxis()
 {
     if (type == VirtualInputChannelType.Axis)
     {
         if (isAxisToAxisRemapped)
         {
             float value = UnInput.GetAxisRaw(name);
             if (value < 0)
             {
                 return(-Easing.Ease(axisToAxisRemapType, axisToAxisRemapPhase, -value) * axisToAxisRemapScale);
             }
             else
             {
                 return(Easing.Ease(axisToAxisRemapType, axisToAxisRemapPhase, value) * axisToAxisRemapScale);
             }
         }
         else
         {
             return(UnInput.GetAxisRaw(name));
         }
     }
     else if (type == VirtualInputChannelType.Button)
     {
         if (negName != null)
         {
             bool pos = UnInput.GetButton(name), neg = UnInput.GetButton(negName);
             if (pos ^ neg)
             {
                 return(pos ? buttonToAxisValue : -buttonToAxisValue);
             }
             else
             {
                 return(0);
             }
         }
         else
         {
             return(UnInput.GetButton(name) ? buttonToAxisValue : 0);
         }
     }
     else              // Key
     {
         if (negKey != UnKeyCode.None)
         {
             bool pos = UnInput.GetKey(key), neg = UnInput.GetKey(negKey);
             if (pos ^ neg)
             {
                 return(pos ? buttonToAxisValue : -buttonToAxisValue);
             }
             else
             {
                 return(0);
             }
         }
         else
         {
             return(UnInput.GetKey(key) ? buttonToAxisValue : 0);
         }
     }
 }
コード例 #3
0
 public static bool GetInput(IList <KeyCode> list)
 {
     return(ForAny(list, delegate(KeyCode keyCode)
     {
         return UInput.GetKey(keyCode);
     }));
 }
コード例 #4
0
        /// <summary>
        /// Update an Interaction Bool data type from a Bool input
        /// </summary>
        /// <remarks>
        /// Raises an Input System "Input Down" event when the key is down, and raises an "Input Up" when it is released (e.g. a Button)
        /// Also raises a "Pressed" event while pressed
        /// </remarks>
        protected void UpdateButtonData(MixedRealityInteractionMapping interactionMapping)
        {
            Debug.Assert(interactionMapping.AxisType == AxisType.Digital);

            var keyButton = UInput.GetKey(interactionMapping.KeyCode);

            // Update the interaction data source
            interactionMapping.BoolData = keyButton;

            // If our value changed raise it.
            if (interactionMapping.Changed)
            {
                // Raise input system Event if it enabled
                if (interactionMapping.BoolData)
                {
                    MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
                }
                else
                {
                    MixedRealityToolkit.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
                }
            }
            else
            {
                if (interactionMapping.BoolData)
                {
                    MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
                }
            }
        }
コード例 #5
0
ファイル: CameraBehavior.cs プロジェクト: cramt/deenee
        private void HandleMovement()
        {
            void move(Vector3 direction)
            {
                transform.Translate(transform.rotation * direction * movespeed, Space.World);
            }

            if (Input.GetKey(KeyCode.W))
            {
                move(Vector3.forward);
            }
            if (Input.GetKey(KeyCode.A))
            {
                move(Vector3.left);
            }
            if (Input.GetKey(KeyCode.S))
            {
                move(Vector3.back);
            }
            if (Input.GetKey(KeyCode.D))
            {
                move(Vector3.right);
            }
            if (Input.GetKey(KeyCode.LeftShift))
            {
                move(Vector3.down);
            }
            if (Input.GetKey(KeyCode.Space))
            {
                move(Vector3.up);
            }
        }
コード例 #6
0
 public override bool GetButtonHeld(Keybind bind)
 {
     if (bind.HasBinding(InputType.KeyboardMouse))
     {
         return(UInp.GetKey(bind.GetBinding(InputType.KeyboardMouse).KeyCode));
     }
     return(false);
 }
コード例 #7
0
ファイル: Input.cs プロジェクト: Tezza48/AGBIC17_HoardIt
        public int getVertical()
        {
            int value;

            value  = UnityInput.GetKey(m_MoveDirections[0]) ? 1 : 0;
            value -= UnityInput.GetKey(m_MoveDirections[2]) ? 1 : 0;
            return(value);
        }
コード例 #8
0
ファイル: Input.cs プロジェクト: Tezza48/AGBIC17_HoardIt
        public int getHorizontal()
        {
            int value;

            value  = UnityInput.GetKey(m_MoveDirections[1]) ? 1 : 0;
            value -= UnityInput.GetKey(m_MoveDirections[3]) ? 1 : 0;
            return(value);
        }
コード例 #9
0
        // Update is called once per frame
        void Update()
        {
            if (!isLocalPlayer)
            {
                return;
            }

            if (!Input.GetMouseButton((int)MouseButton.LeftMouse))
            {
                // We are not holding the mouse button. Release the object and return before checking for a new one
                if (rigidbodyOfObject != null)
                {
                    Drop();
                }

                return;
            }

            if (rigidbodyOfObject == null)
            {
                // We are not holding an object, look for one to pick up

                Debug.DrawLine(transform.position, transform.position + cameraFollow.transform.forward * MaxPickupDistance, Color.yellow);
                if (Physics.Raycast(transform.position, cameraFollow.transform.forward, out hit, MaxPickupDistance))
                {
                    // Don't pick up kinematic rigidbodies (they can't move)
                    if (hit.rigidbody != null && !hit.rigidbody.isKinematic)
                    {
                        PickUp();
                    }
                }
            }
            else
            {
                // We are already holding an object, listen for rotation input
                if (Input.GetKey(KeyCode.R))
                {
                    rotationInput += new Vector2(rotationInput.x, 1);
                }
                if (Input.GetKey(KeyCode.F))
                {
                    rotationInput -= new Vector2(rotationInput.x, 1);
                }
                if (Input.GetKey(KeyCode.Q))
                {
                    rotationInput += new Vector2(1, rotationInput.y);
                }
                if (Input.GetKey(KeyCode.E))
                {
                    rotationInput -= new Vector2(1, rotationInput.y);
                }
                if (Input.GetMouseButtonDown((int)MouseButton.RightMouse))
                {
                    isThrowing = true;
                }
            }
        }
コード例 #10
0
        public override Vector2 GetVector(Keybind _bind)
        {
            var bind = _bind.KBM;

            if (!bind.Valid)
            {
                return(Vector2.zero);
            }

            if (bind.IsAbsoluteMousePosition)
            {
                return(UInp.mousePosition);
            }
            else if (bind.IsMouseLook)
            {
                return(MouseMove);
            }
            else if (bind.IsScrollWheel)
            {
                return(UInp.mouseScrollDelta);
            }

            var  vec  = Vector2.zero;
            bool used = false;

            if (UInp.GetKey(bind.KBMUpKey))
            {
                used = true;
                vec += Vector2.up;
            }

            if (UInp.GetKey(bind.KBMDownKey))
            {
                used = true;
                vec -= Vector2.up;
            }

            if (UInp.GetKey(bind.KBMRightKey))
            {
                used = true;
                vec += Vector2.right;
            }

            if (UInp.GetKey(bind.KBMLeftKey))
            {
                used = true;
                vec -= Vector2.right;
            }

            if (!used)
            {
                return(Vector2.zero);
            }

            return(vec.normalized);
        }
コード例 #11
0
 protected void InitKeyHoldStream()
 {
     KeyHoldStream = Observable.EveryUpdate()
                     .Where
                         (_ => Input.anyKey)
                     .SelectMany
                         (_ => listenKeyCodes)
                     .Where
                         (key => Input.GetKey(key));
 }
コード例 #12
0
ファイル: Input.cs プロジェクト: Tezza48/AGBIC17_HoardIt
 public static bool getButton(int playerIndex, int button)
 {
     if (button < 0 && button >= 2)
     {
         throw new Exception("getButtonDown: Button must be 0 or 1, you entered: " + button);
     }
     else
     {
         return(UnityInput.GetKey(m_PlayerInputs[playerIndex].Buttons[button]));
     }
 }
コード例 #13
0
 private float key2axis()
 {
     if (DefInput.GetKey(this.key))
     {
         return(1.0f);
     }
     else
     {
         return(0.0f);
     }
 }
コード例 #14
0
ファイル: CameraBehavior.cs プロジェクト: cramt/deenee
 private void HandleRotation()
 {
     if (Input.GetKey(KeyCode.Mouse1))
     {
         var pos1 = Input.mousePosition;
         InvokeFunction(() => {
             var pos2 = Input.mousePosition;
             var diff = pos1 - pos2;
             transform.eulerAngles += new Vector3(-diff.y, diff.x, 0) * dragSpeed;
         });
     }
 }
コード例 #15
0
 protected void InitKeyDownStream()
 {
     KeyDownStream = Observable.EveryUpdate()
                     .Where
                         (_ => Input.anyKeyDown)
                     .SelectMany
                         (_ => listenKeyCodes)
                     .Where
                         (key => Input.GetKeyDown(key) || Input.GetKey(key))
                     .Do
                         (_ => E.Input.IsAnyKeyHoldDown = true);
 }
コード例 #16
0
            public static int GetInputAxis(KeyCode positive, KeyCode negative)
            {
                if (UInput.GetKey(positive))
                {
                    return(1);
                }
                else if (UInput.GetKey(negative))
                {
                    return(-1);
                }

                return(0);
            }
コード例 #17
0
        protected override bool PollHeld(KeyCode inputBind)

        {
            bool bRet = UInput.GetKey(inputBind);



            RetroEvents.Chapter("Input_" + BoundInputID.ToString()).Set(new KeyInputEvent(bRet, Time.deltaTime, IsJoystick, BoundInputID));



            return(bRet);
        }
コード例 #18
0
        private void OnGUI()
        {
            if (SimpleWebXR.InSession)
            {
                return;
            }

            if (UInput.mouseScrollDelta.y != 0)
            {
                _lastScrollTime = Time.time;
            }

            var wheelScroll = (Time.time - _lastScrollTime) < 1;


            var txt = new StringBuilder();

            txt.Append("    <b>Help</b>\r\nMove camera with arrows : ");
            Append(txt, "LEFT", UInput.GetKey(KeyCode.LeftArrow));
            txt.Append(", ");
            Append(txt, "RIGHT", UInput.GetKey(KeyCode.RightArrow));
            txt.Append(", ");
            Append(txt, "UP", UInput.GetKey(KeyCode.UpArrow));
            txt.Append(", ");
            Append(txt, "DOWN", UInput.GetKey(KeyCode.DownArrow));

            txt.Append("\r\nRotate camera : ");
            Append(txt, "Right Mouse Button", UInput.GetMouseButton(1));

            txt.Append("\r\nMove hands : ");
            Append(txt, "Left Shift", UInput.GetKey(KeyCode.LeftShift));
            txt.Append(", ");
            Append(txt, "Space Bar", UInput.GetKey(KeyCode.Space));

            txt.Append("\r\nToggle hands : ");
            Append(txt, "T ", UInput.GetKey(KeyCode.T));
            txt.Append(", ");
            Append(txt, "Y", UInput.GetKey(KeyCode.Y));

            txt.Append("\r\nMove hand : ");
            Append(txt, "Left Shift + Wheel", UInput.GetKey(KeyCode.LeftShift) && wheelScroll);

            txt.Append("\r\nRotate hand : ");
            Append(txt, "Left Shift + Left CTRL + Wheel", UInput.GetKey(KeyCode.LeftShift) && UInput.GetKey(KeyCode.LeftControl) && wheelScroll);

            txt.Append("\r\nPinch / Select : ");
            Append(txt, "Left Mouse Button", UInput.GetMouseButton(0));

            GUI.Label(new Rect(0, 0, Screen.width, Screen.height), txt.ToString());
        }
        private void HandleBodyInputIfNeeded()
        {
            if (catchesBodyMovement == false)
            {
                return;
            }

            _cachedArgs.horisontalWorldInputValue = 0f;
            _cachedArgs.verticalWorldInputValue   = 0f;

            bool right      = UnityInput.GetKey(settings.inputSceme.right);
            bool left       = UnityInput.GetKey(settings.inputSceme.left);
            bool horisontal = left || right;

            bool forward  = UnityInput.GetKey(settings.inputSceme.forward);
            bool back     = UnityInput.GetKey(settings.inputSceme.back);
            bool vertical = back || forward;

            float hInputValue = 0f;
            float vInputValue = 0f;

            if (horisontal)
            {
                hInputValue += right ? 1f : 0f;
                hInputValue -= left ? 1f : 0f;
                _cachedArgs.horisontalWorldInputValue = hInputValue;
            }

            if (vertical)
            {
                vInputValue += forward ? 1f : 0f;
                vInputValue -= back ? 1f : 0f;
                _cachedArgs.verticalWorldInputValue = vInputValue;
            }

            if (vertical || horisontal)
            {
                InvokeInputEvent(EMovementInputType.body, _cachedArgs);
                _prevFrameGotInput = true;
            }
            else
            {
                if (_prevFrameGotInput)
                {
                    InvokeInputEvent(EMovementInputType.release, _cachedArgs);
                    _prevFrameGotInput = false;
                }
            }
        }
コード例 #20
0
ファイル: Input.cs プロジェクト: popcron/input
    public static new bool GetKey(KeyCode keyCode)
    {
        if (!Enabled)
        {
            return(false);
        }

#if UNITY_EDITOR
        if (IsOnWindows)
        {
            return(keys.Contains(keyCode));
        }
#endif
        return(UnityInput.GetKey(keyCode));
    }
コード例 #21
0
 public bool GetButton()
 {
     if (type == VirtualInputChannelType.Axis)
     {
         return(UnInput.GetAxisRaw(name) > axisToButtonThreshold);
     }
     else if (type == VirtualInputChannelType.Button)
     {
         return(UnInput.GetButton(name));
     }
     else
     {
         return(UnInput.GetKey(key));
     }
 }
コード例 #22
0
        /// <summary>
        /// Manages cursor lock, quits out of the application if the user hits Escape while not
        /// cursor locked, and makes the camera follow the pointer if the cursor is locked.
        /// </summary>
        protected override void InternalUpdate()
        {
            if (UnityInput.GetKey(KeyCode.LeftShift) ||
                UnityInput.GetKey(KeyCode.RightShift))
            {
                ScrollDelta = new Vector2(UnityInput.mouseScrollDelta.y, 0);
            }
            else
            {
                ScrollDelta = UnityInput.mouseScrollDelta;
            }

            showProbe = !Cursor.visible;

            base.InternalUpdate();
        }
コード例 #23
0
ファイル: KeyboardInput.cs プロジェクト: NLferdiNL/TeleCube
    void Update()
    {
        id.click = id.leftArrow = id.rightArrow = id.upArrow = id.downArrow = false;

        id.mouseMove = Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0;

        if (id.mouseMove)
        {
            id.mousePos = Input.mousePosition;
        }

        id.click      = In.GetMouseButtonDown(0);
        id.leftArrow  = In.GetKey(Kc.LeftArrow) || In.GetKey(Kc.A);
        id.rightArrow = In.GetKey(Kc.RightArrow) || In.GetKey(Kc.D);
        id.upArrow    = In.GetKey(Kc.UpArrow) || In.GetKey(Kc.W) || In.GetKey(Kc.Space);
        id.downArrow  = In.GetKey(Kc.DownArrow) || In.GetKey(Kc.S);
    }
        /// <summary>
        /// Update an Interaction Bool data type from a Bool input
        /// </summary>
        /// <remarks>
        /// <para>Raises an Input System "Input Down" event when the key is down, and raises an "Input Up" when it is released (e.g. a Button).
        /// Also raises a "Pressed" event while pressed.</para>
        /// </remarks>
        protected void UpdateButtonData(MixedRealityInteractionMapping interactionMapping)
        {
            using (UpdateButtonDataPerfMarker.Auto())
            {
                Debug.Assert(interactionMapping.AxisType == AxisType.Digital);

                // Update the interaction data source
                switch (interactionMapping.InputType)
                {
                case DeviceInputType.TriggerPress:
                    interactionMapping.BoolData = UInput.GetAxisRaw(interactionMapping.AxisCodeX).Equals(1);
                    break;

                case DeviceInputType.TriggerTouch:
                case DeviceInputType.TriggerNearTouch:
                case DeviceInputType.ThumbNearTouch:
                case DeviceInputType.IndexFingerNearTouch:
                case DeviceInputType.MiddleFingerNearTouch:
                case DeviceInputType.RingFingerNearTouch:
                case DeviceInputType.PinkyFingerNearTouch:
                    interactionMapping.BoolData = interactionMapping.KeyCode == KeyCode.None ?
                                                  !UInput.GetAxisRaw(interactionMapping.AxisCodeX).Equals(0) :
                                                  UInput.GetKey(interactionMapping.KeyCode);
                    break;

                default:
                    interactionMapping.BoolData = UInput.GetKey(interactionMapping.KeyCode);
                    break;
                }

                // If our value changed raise it.
                if (interactionMapping.Changed)
                {
                    // Raise input system event if it's enabled
                    if (interactionMapping.BoolData)
                    {
                        CoreServices.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
                    }
                    else
                    {
                        CoreServices.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
                    }
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// Update an Interaction Bool data type from a Bool input
        /// </summary>
        /// <remarks>
        /// Raises an Input System "Input Down" event when the key is down, and raises an "Input Up" when it is released (e.g. a Button)
        /// Also raises a "Pressed" event while pressed
        /// </remarks>
        protected void UpdateButtonData(MixedRealityInteractionMapping interactionMapping)
        {
            Profiler.BeginSample("[MRTK] GenericJoystickController.UpdateButtonData");

            Debug.Assert(interactionMapping.AxisType == AxisType.Digital);

            // Update the interaction data source
            switch (interactionMapping.InputType)
            {
            case DeviceInputType.TriggerPress:
                interactionMapping.BoolData = UInput.GetAxisRaw(interactionMapping.AxisCodeX).Equals(1);
                break;

            case DeviceInputType.TriggerNearTouch:
            case DeviceInputType.ThumbNearTouch:
            case DeviceInputType.IndexFingerNearTouch:
            case DeviceInputType.MiddleFingerNearTouch:
            case DeviceInputType.RingFingerNearTouch:
            case DeviceInputType.PinkyFingerNearTouch:
                interactionMapping.BoolData = !UInput.GetAxisRaw(interactionMapping.AxisCodeX).Equals(0);
                break;

            default:
                interactionMapping.BoolData = UInput.GetKey(interactionMapping.KeyCode);
                break;
            }

            // If our value changed raise it.
            if (interactionMapping.Changed)
            {
                // Raise input system event if it's enabled
                if (interactionMapping.BoolData)
                {
                    CoreServices.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
                }
                else
                {
                    CoreServices.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
                }
            }

            Profiler.EndSample(); // UpdateButtonData
        }
コード例 #26
0
ファイル: ModInput.cs プロジェクト: YLMAPI/YLMAPI
        static ModInput()
        {
            // TODO: This mapping list.
            _InitButtonMap(9, "Jump", "A");
            _InitButtonMap(10, "Fly");
            _InitButtonMap(12, "Context");
            _InitButtonMap(14, "TongueEdibleItem", "B");
            _InitButtonMap_Not(input => UEInput.GetMouseButton(1), "B");
            _InitButtonMap(15, "Invisibility");
            _InitButtonMap(16, "BasicAttack", "ShootEatenItem", "X");
            _InitButtonMap_Not(input => UEInput.GetMouseButton(0), "X");
            _InitButtonMap(18, "WheelSpin");
            _InitButtonMap(19, "FartBubble");
            _InitButtonMap(20, "Crouch", "LT", "L2");
            _InitButtonMap(21, "GroundPound");
            _InitButtonMap(22, "SwimUnderwater");
            _InitButtonMap(23, "Wheel", "RT", "R2");
            _InitButtonMap(24, "RB", "R1");
            _InitButtonMap_Not(50, "RB", "R1");
            _InitButtonMap_Not(input => UEInput.GetMouseButton(2), "RB", "R1");
            _InitButtonMap(25, "LB", "L1");
            _InitButtonMap_Not(input => UEInput.mouseScrollDelta.y > 0f, "LB", "L1");
            _InitButtonMap(27, "SonarBlastAttack", "Y");
            _InitButtonMap(28, "SonarBoomAttack");
            _InitButtonMap(29, "SonarShieldAttack");
            _InitButtonMap(30, "Aiming");
            _InitButtonMap(39, "EmoteHappy", "DPadUp");
            _InitButtonMap(40, "EmoteTaunt", "DPadRight");
            _InitButtonMap(41, "EmoteDisappointed", "DPadDown");
            _InitButtonMap(42, "EmoteAngry", "DPadLeft");
            _InitButtonMap(49, "LS", "L3");
            _InitButtonMap(50, "RS", "R3");
            _InitButtonMap(51, "SwimUnderwaterAlt");

            AxisMap["Horizontal"]   = input => input.GetAxis(0) + (UEInput.GetKey(KeyCode.A) ? -1f : UEInput.GetKey(KeyCode.D) ? 1f : 0f);
            AxisMap["Vertical"]     = input => input.GetAxis(1) + (UEInput.GetKey(KeyCode.S) ? -1f : UEInput.GetKey(KeyCode.W) ? 1f : 0f);
            AxisMap["FPV Camera X"] = input => input.GetAxisRaw(4) * 0.4f + input.GetAxisRaw(47) * 0.07f;
            AxisMap["FPV Camera Y"] = input => input.GetAxisRaw(5) * 0.4f + input.GetAxisRaw(48) * 0.07f;
            AxisMap["Mouse X"]      = input => input.GetAxisRaw(47);
            AxisMap["Mouse Y"]      = input => input.GetAxisRaw(48);
        }
        private void HandleShootingIfNeeded()
        {
            var vert = new int[100];

            var containsList = new List <int> (vert.Length);
            var constainsSet = new HashSet <int> (containsList);

            bool shootKey = UnityInput.GetKey(settings.inputSceme.shootKey);

            if (shootKey && !_didBeginShooting)
            {
                InvokeShootingEvent(EShootingEventType.push);
                _didBeginShooting = true;
            }

            if (!shootKey && _didBeginShooting)
            {
                InvokeShootingEvent(EShootingEventType.release);
                _didBeginShooting = false;
            }
        }
コード例 #28
0
ファイル: TightRope.cs プロジェクト: Turmolt/ludum-dare-46
        void Update()
        {
            if (!isPlaying)
            {
                return;
            }

            if (LifeSlider.value == 0f)
            {
                GameOver();
            }

            if (Input.GetMouseButton(0) || Input.GetKey(KeyCode.LeftArrow))
            {
                SetDelta(delta - minDelta);
            }

            if (Input.GetMouseButton(1) || Input.GetKey(KeyCode.RightArrow))
            {
                SetDelta(delta + minDelta);
            }

            var pullMultiplier = 2.0f;

            if (BalanceSlider.value < .5f)
            {
                var d = (.5f - BalanceSlider.value) / (1.75f - difficulty / 30f);
                SetDelta(delta - d * minDelta * pullMultiplier);
            }
            else
            {
                var d = (BalanceSlider.value - .5f) / (1.75f - difficulty / 30f);
                SetDelta(delta + d * minDelta * pullMultiplier);
            }

            BalanceSlider.value = Mathf.Clamp01(BalanceSlider.value + delta);
            Skater.eulerAngles  = Skater.eulerAngles.xy(90 - (180 * BalanceSlider.value));
            UpdateLife();
        }
コード例 #29
0
        /// <summary>
        /// Perform keyboard panning
        /// </summary>
        protected void DoKeyboardPan()
        {
            // Left
            if (UnityInput.GetKey(KeyCode.LeftArrow) || UnityInput.GetKey(KeyCode.A))
            {
            }

            // Right
            if (UnityInput.GetKey(KeyCode.RightArrow) || UnityInput.GetKey(KeyCode.D))
            {
            }

            // Down
            if (UnityInput.GetKey(KeyCode.DownArrow) || UnityInput.GetKey(KeyCode.S))
            {
            }

            // Up
            if (UnityInput.GetKey(KeyCode.UpArrow) || UnityInput.GetKey(KeyCode.W))
            {
            }
        }
コード例 #30
0
        /// <summary>
        ///     Ask to update input from Unity's Input
        /// </summary>
        public void Parse(int inputState)
        {
            if (!isLocalPlayer)
            {
                return;
            }

            CurrentInput.InputState = inputState;

            CurrentInput.Left     = UnityInput.GetKey(KeyCode.LeftArrow) || UnityInput.GetKey(KeyCode.A);
            CurrentInput.Right    = UnityInput.GetKey(KeyCode.RightArrow) || UnityInput.GetKey(KeyCode.D);
            CurrentInput.Forward  = UnityInput.GetKey(KeyCode.UpArrow) || UnityInput.GetKey(KeyCode.W);
            CurrentInput.Backward = UnityInput.GetKey(KeyCode.DownArrow) || UnityInput.GetKey(KeyCode.S);

            CurrentInput.SetPitch(cameraAim.Pitch);
            CurrentInput.SetYaw(cameraAim.Yaw);

            CurrentInput.Jump = UnityInput.GetButton("Jump");
            CurrentInput.Fire = UnityInput.GetButton("Fire1");
            CurrentInput.Aim  = UnityInput.GetButton("Fire2");
            CurrentInput.Run  = UnityInput.GetButton("Run");
        }