private void HandlePlayerAxis(MappedInput input)
    {
        if (character == null) return;

        float xValue = 0f;

        if (input.Ranges.ContainsKey("MoveLeft"))
        {
            xValue = -input.Ranges["MoveLeft"];
        }
        else if (input.Ranges.ContainsKey("MoveRight"))
        {
            xValue = input.Ranges["MoveRight"];
        }

        float zValue = 0f;

        if (input.Ranges.ContainsKey("MoveForward"))
        {
            zValue = input.Ranges["MoveForward"];
        }
        else if (input.Ranges.ContainsKey("MoveBackward"))
        {
            zValue = -input.Ranges["MoveBackward"];
        }

        character.Move(xValue, zValue);
    }
예제 #2
0
 private void HandleButtons(MappedInput obj)
 {
     if (obj.Actions.Contains("Dash"))
     {       
             anims[obj.PlayerIndex].SetBool("Dashing", !anims[obj.PlayerIndex].GetBool("Dashing"));
     }
 }
예제 #3
0
    private void HandleCreditsMenuInput(MappedInput input)
    {
        if (this == null || !gameObject.activeSelf) return;

        if (input.Actions.Contains("BackCreditsMenu"))
        {
            MenusManager.Instance.ShowMenu("SimpleMenu");
        }
    }
    private void HandlePlayerButtons(MappedInput input)
    {
        if (character == null) return;

        if (input.Actions.Contains("Dash"))
        {
            character.Dash();
        }
    }
예제 #5
0
        private static float GetPlayerSpeed(Player player)
        {
            if (MappedInput.GetKey("Speed Modifier"))
            {
                player.IsRunning = false;
                return(player.WalkSpeed);
            }

            player.IsRunning = true;
            return(player.RunSpeed);
        }
예제 #6
0
    private void HandlePlayerButtons(MappedInput input)
    {
        if (character == null)
        {
            return;
        }

        if (input.Actions.Contains("Dash"))
        {
            character.Dash();
        }
    }
예제 #7
0
    private void HandleCreditsMenuInput(MappedInput input)
    {
        if (this == null || !gameObject.activeSelf)
        {
            return;
        }

        if (input.Actions.Contains("BackCreditsMenu"))
        {
            MenusManager.Instance.ShowMenu("SimpleMenu");
        }
    }
예제 #8
0
        private void Awake()
        {
            Instance = this;
            MappedInput.AddMapping("Up", KeyCode.W);
            MappedInput.AddMapping("Left", KeyCode.A);
            MappedInput.AddMapping("Down", KeyCode.S);
            MappedInput.AddMapping("Right", KeyCode.D);
            MappedInput.AddMapping("Speed Modifier", KeyCode.LeftShift);
            var position = transform.position;

            _player = new PlayerActual();
            _player.SetPosition(new Position(position.x, position.y));
            _player.OnPlayerTeleported += OnPlayerTeleported;
        }
예제 #9
0
        /// <summary>
        /// Waits a specified number of seconds in real time, can be skipped with skip button
        /// </summary>
        /// <remarks>Can only be used from the main thread</remarks>
        public static async Task DelayRealtime(float time)
        {
            for (float elapsed = 0; elapsed < time; elapsed += Time.unscaledDeltaTime)
            {
                if (MappedInput.GetButtonDown(SkipButton) || MappedInput.GetButtonDown(AltSkipButton) || MappedInput.GetButtonDown(TerSkipButton))
                {
                    break;
                }

                await Task.Yield();
            }

            await Task.Yield();
        }
예제 #10
0
        /// <summary>
        /// Waits for specified time (in real time), can be skipped with skip button
        /// </summary>
        public static IEnumerator WaitForSecondsRealtime(float time)
        {
            for (float elapsed = 0; elapsed < time; elapsed += Time.unscaledDeltaTime)
            {
                if (MappedInput.GetButtonDown(SkipButton) || MappedInput.GetButtonDown(AltSkipButton) || MappedInput.GetButtonDown(TerSkipButton))
                {
                    break;
                }

                yield return(null);
            }

            yield return(null); //necessary for debouncing
        }
예제 #11
0
    private void HandleMenuInput(MappedInput input)
    {
        if (this == null || _loadingNextLevel || !gameObject.activeSelf) return;

        if (input.Actions.Contains("PlayGame"))
        {
            Application.LoadLevel(NextLevel);
            _loadingNextLevel = true;
        }
        else if (input.Actions.Contains("ShowCredits"))
        {
            MenusManager.Instance.ShowMenu("CreditsMenu");
        }
    }
예제 #12
0
        public bool TryMap()
        {
            MappedInput selectedInput = SelectedInput;

            if (selectedInput != null)
            {
                DeviceInput input = _deviceMapper.GetPressedInput();
                if (input != null)
                {
                    selectedInput.Input = input;
                    _currentMapping.Map(selectedInput);
                    return(true);
                }
            }
            return(false);
        }
예제 #13
0
    private void HandleMenuInput(MappedInput input)
    {
        if (this == null || _loadingNextLevel || !gameObject.activeSelf)
        {
            return;
        }

        if (input.Actions.Contains("PlayGame"))
        {
            Application.LoadLevel(NextLevel);
            _loadingNextLevel = true;
        }
        else if (input.Actions.Contains("ShowCredits"))
        {
            MenusManager.Instance.ShowMenu("CreditsMenu");
        }
    }
예제 #14
0
        protected void HandleLook()
        {
            const float deadzone = 0.1f; //this really shouldn't be here
            const float lmul     = 180f; //mostly logical look multiplier

            if (GameState.Instance.PlayerFlags.Contains(PlayerFlags.TotallyFrozen))
            {
                return;
            }

            //looking is the same as long as we're in control
            if (Mathf.Abs(MappedInput.GetAxis(DefaultControls.LookX)) != 0)
            {
                transform.Rotate(Vector3.up, lmul * ConfigState.Instance.LookSpeed * MappedInput.GetAxis(DefaultControls.LookX) * Time.deltaTime);
                if (Mathf.Abs(MappedInput.GetAxis(DefaultControls.LookX)) > deadzone && CountRotateAsMovement)
                {
                    IsMoving = true;
                }
            }

            if (Mathf.Abs(MappedInput.GetAxis(DefaultControls.LookY)) != 0)
            {
                int lookYInvert = ConfigState.Instance.LookInvert ? -1 : 1;

                //this is probably the worst clamp code ever written

                Vector3 localForward  = PlayerController.CameraRoot.parent.transform.InverseTransformDirection(PlayerController.CameraRoot.transform.forward);
                float   originalAngle = Vector2.SignedAngle(Vector2.right, localForward.GetSideVector());
                float   deltaAngle    = lmul * ConfigState.Instance.LookSpeed * lookYInvert * MappedInput.GetAxis(DefaultControls.LookY) * Time.deltaTime; //this is okay if weird

                if (deltaAngle > 0 && originalAngle + deltaAngle >= LookYLimit)
                {
                    //clamp high
                    deltaAngle = LookYLimit - originalAngle;
                }
                else if (deltaAngle < 0 && originalAngle + deltaAngle <= -LookYLimit)
                {
                    //clamp low
                    deltaAngle = -LookYLimit - originalAngle;
                }

                PlayerController.CameraRoot.transform.Rotate(Vector3.left, deltaAngle);

                //Debug.Log($"{originalAngle} + {deltaAngle}");
            }
        }
예제 #15
0
        /// <summary>
        /// Waits for specified time, can be skipped with skip button
        /// </summary>
        public static IEnumerator WaitForSeconds(float time)
        {
            for (float elapsed = 0; elapsed < time; elapsed += Time.deltaTime)
            {
                if (!LockPauseModule.IsInputLocked())
                {
                    if (MappedInput.GetButtonDown(SkipButton) || MappedInput.GetButtonDown(AltSkipButton) || MappedInput.GetButtonDown(TerSkipButton))
                    {
                        break;
                    }
                }

                yield return(null);
            }

            yield return(null); //necessary for debouncing
        }
예제 #16
0
    private void HandleMenuInput(MappedInput input)
    {
        float yAxis = 0f;

        if (input.Ranges.ContainsKey("SelectOptionUp"))
        {
            yAxis = input.Ranges["SelectOptionUp"];
        }
        else if (input.Ranges.ContainsKey("SelectOptionDown"))
        {
            yAxis = -input.Ranges["SelectOptionDown"];
        }

        bool accept = input.Actions.Contains("Accept");

        MenusManager.Instance.SetInputValues(accept, false, 0f, yAxis);
    }
예제 #17
0
        /// <summary>
        /// Waits a specified number of seconds in scaled (game) time, can be skipped with skip button
        /// </summary>
        /// <remarks>Can only be used from the main thread</remarks>
        public static async Task DelayScaled(float time)
        {
            for (float elapsed = 0; elapsed < time; elapsed += Time.deltaTime)
            {
                if (!LockPauseModule.IsInputLocked())
                {
                    if (MappedInput.GetButtonDown(SkipButton) || MappedInput.GetButtonDown(AltSkipButton) || MappedInput.GetButtonDown(TerSkipButton))
                    {
                        break;
                    }
                }

                await Task.Yield();
            }

            await Task.Yield();
        }
예제 #18
0
    private void HandleBatActions(MappedInput input)
    {
        if (this == null) return; //Bad hotfix code, should be fixed

        Move(input);

        if (input.Actions.Contains("Action")) {

            if (isInInteractionRange && interactiveElement != null) {

                interactiveElement.GetComponent<Switch>().Activate();

                batAnimator.Shout();
            }

        }
    }
예제 #19
0
        private bool GetSkipKeyDown()
        {
            if (LockPauseModule.IsInputLocked())
            {
                return(false);
            }

            if (UseUnityInput && (UnityEngine.Input.GetButtonDown("Submit") || UnityEngine.Input.GetKeyDown(KeyCode.Space)))
            {
                return(true);
            }

            if (UseMappedInput && (MappedInput.GetButtonDown(DefaultControls.Confirm) || MappedInput.GetButtonDown(DefaultControls.Fire) || MappedInput.GetButtonDown(DefaultControls.Use)))
            {
                return(true);
            }

            return(false);
        }
예제 #20
0
    private void HandleVampireActions(MappedInput input)
    {
        if (this == null) return; //Bad hotfix code, should be fixed

        float xAxisValue = 0f;

        if (input.Ranges.ContainsKey("MoveLeftVampire"))
        {
            xAxisValue = -input.Ranges["MoveLeftVampire"];

            _hasMoved = true;
        }
        else if (input.Ranges.ContainsKey("MoveRightVampire"))
        {
            xAxisValue = input.Ranges["MoveRightVampire"];

            _hasMoved = true;
        }

        _vampireAnimator.Move(xAxisValue);
        _vampire.Move(xAxisValue);

        bool jumpPressed = input.States.Contains("Jump");

        if (jumpPressed)
        {
            _hasMoved = true;
        }

        bool isGrounded = _vampire.IsGrounded();

        if (jumpPressed && !_jumpAlreadyPressed && isGrounded)
        {
            _vampire.StartJumping();
        }
        else if (!jumpPressed)
        {
            _vampire.StopJumping();
        }

        _jumpAlreadyPressed = jumpPressed;
    }
예제 #21
0
        private static Position GetInputAxis()
        {
            var pos = new Position();

            if (MappedInput.GetKey("Up"))
            {
                pos += new Position(0, 1);
            }
            if (MappedInput.GetKey("Down"))
            {
                pos += new Position(0, -1);
            }
            if (MappedInput.GetKey("Left"))
            {
                pos += new Position(-1, 0);
            }
            if (MappedInput.GetKey("Right"))
            {
                pos += new Position(1, 0);
            }
            return(pos);
        }
예제 #22
0
        /// <summary>
        /// Apply the current ConfigState configuration to the game
        /// </summary>
        public void ApplyConfiguration()
        {
            //AUDIO CONFIG
            AudioListener.volume = ConfigState.Instance.SoundVolume;
            var ac = AudioSettings.GetConfiguration();

            ac.speakerMode = ConfigState.Instance.SpeakerMode;
            AudioSettings.Reset(ac);

            //VIDEO CONFIG
            if (ConfigState.Instance.UseCustomVideoSettings)
            {
                ApplyExtendedGraphicsConfiguration();
            }

            QualitySettings.vSyncCount  = ConfigState.Instance.VsyncCount;
            Application.targetFrameRate = ConfigState.Instance.MaxFrames;

            //INPUT CONFIG
            MappedInput.SetMapper(ConfigState.Instance.InputMapper); //safe?

            //let other things handle it on their own
            QdmsMessageBus.Instance.PushBroadcast(new ConfigChangedMessage());
        }
예제 #23
0
 public MappedInputItem(string name, MappedInput mappedInput)
     : base(Consts.KEY_NAME, name)
 {
     _mappedInput = mappedInput;
     Update();
 }
예제 #24
0
        private void CheckMenuOpen()
        {
            if (LockPauseModule.GetInputLockState() == InputLockType.All)
            {
                return;
            }

            bool menuToggled = UnityEngine.Input.GetKeyDown(KeyCode.Escape) || MappedInput.GetButtonDown(Input.DefaultControls.OpenMenu);

            if (menuToggled)
            {
                //if we're locked out, let the menu be closed but not opened
                if (!AllowMenu)
                {
                    if (MainPanel.activeSelf)
                    {
                        MainPanel.SetActive(false);

                        if (HandlePause)
                        {
                            DoUnpause();
                        }

                        foreach (Transform child in ContainerPanel.transform)
                        {
                            child.gameObject.SetActive(false);
                        }

                        ClearEphemeral();
                    }
                }
                else
                {
                    //otherwise, flip state
                    bool newState = !MainPanel.activeSelf;
                    MainPanel.SetActive(newState);

                    if (HandlePause)
                    {
                        if (newState)
                        {
                            DoPause();
                        }
                        else
                        {
                            DoUnpause();
                        }
                    }

                    if (newState && !string.IsNullOrEmpty(DefaultPanel))
                    {
                        OnClickSelectButton(DefaultPanel);
                    }

                    if (!newState)
                    {
                        foreach (Transform child in ContainerPanel.transform)
                        {
                            child.gameObject.SetActive(false);
                        }

                        ClearEphemeral();
                    }

                    if (newState)
                    {
                        //run scripts
                        ScriptingModule.CallHooked(ScriptHook.OnIGUIMenuOpen, this);
                    }
                }
            }
        }
예제 #25
0
    private void HandlePlayerButtons(MappedInput input)
    {
        // No keyboard code (only xbox controllers)
        /*
        if (this == null) return;

        if (input.Actions.Contains("Jump"))
        {
            _child.Jump();
        }

        if (input.Actions.Contains("Sleep") && _child.Sleep())
        {
            Debug.Log("SLEEPING");
            InputManager.Instance.PushActiveContext("Sleeping", (int)PlayerNumber);
        }
        else if (input.Actions.Contains("WakeUp"))
        {
            Debug.Log("AWAKE");
            _child.WakeUp();
            InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
        }*/

        if (this == null) return;

        if (input.PlayerIndex == 3)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                _child.Jump();
            }

            if (Input.GetKeyDown(KeyCode.X) && !_child.IsSleeping && _child.Sleep())
            {
                Debug.Log("SLEEPING");
                InputManager.Instance.PushActiveContext("Sleeping", (int)PlayerNumber);
            }
            else if (Input.GetKeyDown(KeyCode.X) && _child.IsSleeping)
            {
                Debug.Log("AWAKE");
                _child.WakeUp();
                InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
            }
        }
        else
        {
            if (input.Actions.Contains("Jump"))
            {
                _child.Jump();
            }

            if (input.Actions.Contains("Sleep") && _child.Sleep())
            {
                Debug.Log("SLEEPING");
                InputManager.Instance.PushActiveContext("Sleeping", (int)PlayerNumber);
            }
            else if (input.Actions.Contains("WakeUp"))
            {
                Debug.Log("AWAKE");
                _child.WakeUp();
                InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
            }
        }
    }
예제 #26
0
    private void HandlePlayerAxis(MappedInput input)
    {
        // No keyboard code (only xbox controllers)
        if (this == null || !_child.Mom.StartGame) return;

        // movement

        float xValue = 0f;

        if (input.Ranges.ContainsKey("MoveLeft"))
        {
            xValue = -input.Ranges["MoveLeft"];
        }
        else if (input.Ranges.ContainsKey("MoveRight"))
        {
            xValue = input.Ranges["MoveRight"];
        }

        float zValue = 0f;

        if (input.Ranges.ContainsKey("MoveForward"))
        {
            zValue = input.Ranges["MoveForward"];
        }
        else if (input.Ranges.ContainsKey("MoveBackward"))
        {
            zValue = -input.Ranges["MoveBackward"];
        }

        _child.Move(xValue, zValue);

        // targeting

        float xLookingValue = 0f;

        if (input.Ranges.ContainsKey("LookLeft"))
        {
            xLookingValue = -input.Ranges["LookLeft"];
        }
        else if (input.Ranges.ContainsKey("LookRight"))
        {
            xLookingValue = input.Ranges["LookRight"];
        }

        float zLookingValue = 0f;

        if (input.Ranges.ContainsKey("LookForward"))
        {
            zLookingValue = input.Ranges["LookForward"];
        }
        else if (input.Ranges.ContainsKey("LookBackward"))
        {
            zLookingValue = -input.Ranges["LookBackward"];
        }

        if (xLookingValue != 0 || zLookingValue != 0)
        {

            transform.eulerAngles = new Vector3(
                    transform.eulerAngles.x,
                    Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg - 90, // -90 to correct forward facing angle...
                    transform.eulerAngles.z);

        }
        else
        {

            // if player is not look with the right joystick, then face the direction we're going
            // if left joystick is used, else we don't change the facing direction
            if (xValue != 0 || zValue != 0)
            {
                transform.eulerAngles = new Vector3(
                    transform.eulerAngles.x,
                    Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg - 90,
                    transform.eulerAngles.z);
            }
        }

        if (input.Ranges.ContainsKey("Throw"))
            _child.Throw();

        if (input.Actions.Contains("Hit"))
            _child.Swing();

        // Keyboard + mouse code (for the fourth player)
        /*if (this == null || !_child.Mom.StartGame) return;

        float xValue = 0f;
        float zValue = 0f;
        float xLookingValue = 0f;
        float zLookingValue = 0f;

        bool throwPressed = false;
        bool hitPressed = false;

        if (input.PlayerIndex == 3)
        {
            if (Input.GetKey(KeyCode.A))
            {
                xValue = -1f;
            }
            else if (Input.GetKey(KeyCode.D))
            {
                xValue = 1f;
            }

            if (Input.GetKey(KeyCode.W))
            {
                zValue = 1f;
            }
            else if (Input.GetKey(KeyCode.S))
            {
                zValue = -1f;
            }

            Vector3 mousePos = Input.mousePosition;

            mousePos.z = Vector3.Distance(new Vector3(0f, transform.position.y, 0f), Camera.main.transform.position);

            Vector3 mouseWorldPos = Camera.main.ScreenToWorldPoint(mousePos);

            Vector3 relAxis = (new Vector3(mouseWorldPos.x, transform.position.y, mouseWorldPos.z) - transform.position).normalized;

            xLookingValue = relAxis.x;
            zLookingValue = relAxis.z;

            // targeting

            if (xLookingValue != 0 || zLookingValue != 0)
            {

                transform.eulerAngles = new Vector3(
                        transform.eulerAngles.x,
                        Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg, // -90 to correct forward facing angle...
                        transform.eulerAngles.z);

            }
            else
            {

                // if player is not look with the right joystick, then face the direction we're going
                // if left joystick is used, else we don't change the facing direction
                if (xValue != 0 || zValue != 0)
                {
                    transform.eulerAngles = new Vector3(
                        transform.eulerAngles.x,
                        Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg,
                        transform.eulerAngles.z);
                }
            }

            throwPressed = Input.GetKeyDown(KeyCode.Mouse0);
        }
        else
        {
            if (input.Ranges.ContainsKey("MoveLeft"))
            {
                xValue = -input.Ranges["MoveLeft"];
            }
            else if (input.Ranges.ContainsKey("MoveRight"))
            {
                xValue = input.Ranges["MoveRight"];
            }

            if (input.Ranges.ContainsKey("MoveForward"))
            {
                zValue = input.Ranges["MoveForward"];
            }
            else if (input.Ranges.ContainsKey("MoveBackward"))
            {
                zValue = -input.Ranges["MoveBackward"];
            }

            if (input.Ranges.ContainsKey("LookLeft"))
            {
                xLookingValue = -input.Ranges["LookLeft"];
            }
            else if (input.Ranges.ContainsKey("LookRight"))
            {
                xLookingValue = input.Ranges["LookRight"];
            }

            if (input.Ranges.ContainsKey("LookForward"))
            {
                zLookingValue = input.Ranges["LookForward"];
            }
            else if (input.Ranges.ContainsKey("LookBackward"))
            {
                zLookingValue = -input.Ranges["LookBackward"];
            }

            // targeting

            if (xLookingValue != 0 || zLookingValue != 0)
            {

                transform.eulerAngles = new Vector3(
                        transform.eulerAngles.x,
                        Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg - 90, // -90 to correct forward facing angle...
                        transform.eulerAngles.z);

            }
            else
            {

                // if player is not look with the right joystick, then face the direction we're going
                // if left joystick is used, else we don't change the facing direction
                if (xValue != 0 || zValue != 0)
                {
                    transform.eulerAngles = new Vector3(
                        transform.eulerAngles.x,
                        Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg - 90,
                        transform.eulerAngles.z);
                }
            }

            throwPressed = input.Ranges.ContainsKey("Throw");
            hitPressed = input.Actions.Contains("Hit");
        }

        _child.Move(xValue, zValue);

        if (throwPressed)
            _child.Throw();

        if (hitPressed)
            _child.Swing();*/
    }
예제 #27
0
        protected void HandleMovement()
        {
            var playerModel = GameState.Instance.PlayerRpgState;

            if (!GameState.Instance.PlayerFlags.Contains(PlayerFlags.Frozen) && !GameState.Instance.PlayerFlags.Contains(PlayerFlags.TotallyFrozen))
            {
                //handle running
                float energyToRun = RpgValues.GetRunEnergyRate(playerModel);

                IsRunning = MappedInput.GetButton(DefaultControls.Sprint);

                if (RunWasBlocked && IsRunning)
                {
                    IsRunning = false;
                }
                else if (RunWasBlocked && !IsRunning)
                {
                    RunWasBlocked = false;
                }

                if (IsRunning && playerModel.Energy < energyToRun)
                {
                    IsRunning     = false;
                    RunWasBlocked = true;
                    QdmsMessageBus.Instance.PushBroadcast(new QdmsFlagMessage("RpgInsufficientEnergy"));
                }


                //TODO check against energy requirements

                //request an exit from ADS
                if (IsRunning && PlayerController.WeaponComponent != null)
                {
                    PlayerController.WeaponComponent.RequestADSExit();
                }

                //handle crouching
                if (MappedInput.GetButtonDown(DefaultControls.Crouch) && !IsRunning)
                {
                    IsCrouching     = !IsCrouching;
                    DidChangeCrouch = true;
                    SetCrouchState();
                }

                //uncrouch if we try to sprint
                if (IsRunning && IsCrouching)
                {
                    IsCrouching     = false;
                    DidChangeCrouch = true;
                    SetCrouchState();
                }

                if (IsGrounded)
                {
                    //normal x/y movement

                    var flatVelocity = new Vector3(Velocity.x, 0, Velocity.z);

                    Vector3 moveVector = Vector3.zero;

                    float maxAcceleration = IsCrouching ? MaxCrouchAcceleration : (IsRunning ? MaxSprintAcceleration : MaxWalkAcceleration);
                    if (Mathf.Abs(MappedInput.GetAxis(DefaultControls.MoveY)) > InputDeadzone)
                    {
                        moveVector += (transform.forward * MappedInput.GetAxis(DefaultControls.MoveY) * maxAcceleration * Time.deltaTime);
                        IsMoving    = true;
                    }

                    if (Mathf.Abs(MappedInput.GetAxis(DefaultControls.MoveX)) > InputDeadzone)
                    {
                        moveVector += (transform.right * MappedInput.GetAxis(DefaultControls.MoveX) * maxAcceleration * Time.deltaTime);
                        IsMoving    = true;
                    }

                    if (Mathf.Approximately(moveVector.magnitude, 0) && !IsOnSlope)
                    {
                        moveVector = -flatVelocity.normalized * Mathf.Min(MaxBrakeAcceleration * Time.deltaTime, flatVelocity.magnitude);
                    }

                    //clamp velocity to maxwalk/maxrun/etc
                    float maxSpeed = IsCrouching ? MaxCrouchSpeed * RpgValues.GetMoveSpeedMultiplier(playerModel) : (IsRunning ? MaxSprintSpeed * RpgValues.GetRunSpeedMultiplier(playerModel) : MaxWalkSpeed * RpgValues.GetMoveSpeedMultiplier(playerModel));
                    maxSpeed *= ConfigState.Instance.GetGameplayConfig().Difficulty.PlayerAgility;
                    var newFlatVelocity = new Vector3(Velocity.x, 0, Velocity.z) + new Vector3(moveVector.x, 0, moveVector.z);
                    if (newFlatVelocity.magnitude > maxSpeed)
                    {
                        newFlatVelocity = newFlatVelocity.normalized * maxSpeed; //this actually doesn't make a ton of physical sense but it does seem to work
                    }

                    Velocity = new Vector3(newFlatVelocity.x, Velocity.y, newFlatVelocity.z);

                    if (IsRunning)
                    {
                        playerModel.Energy -= energyToRun;
                    }
                }
                else
                {
                    //air move: component wise, clamped

                    //awkward bullshit to go from world to player space
                    Vector3 refVelocity    = Quaternion.AngleAxis(-transform.eulerAngles.y, Vector3.up) * Velocity;
                    Vector3 newAddVelocity = Vector3.zero;

                    float multiplier = ConfigState.Instance.GetGameplayConfig().Difficulty.PlayerAgility;
                    multiplier *= RpgValues.GetAirMoveMultiplier(playerModel);

                    float maxSpeedScaled = MaxAirSpeed * multiplier;

                    float moveZ = MappedInput.GetAxis(DefaultControls.MoveY) * MaxAirAcceleration * multiplier * Time.deltaTime;
                    if (Mathf.Abs(refVelocity.z) < maxSpeedScaled || Mathf.Sign(moveZ) != Mathf.Sign(refVelocity.z))
                    {
                        newAddVelocity += new Vector3(0, 0, moveZ);
                    }

                    float moveX = MappedInput.GetAxis(DefaultControls.MoveX) * MaxAirAcceleration * multiplier * Time.deltaTime;
                    if (Mathf.Abs(refVelocity.x) < maxSpeedScaled || Mathf.Sign(moveX) != Mathf.Sign(refVelocity.x))
                    {
                        newAddVelocity += new Vector3(moveX, 0, 0);
                    }

                    Velocity += Quaternion.AngleAxis(transform.eulerAngles.y, Vector3.up) * newAddVelocity;
                }

                if (IsGrounded && (AllowSlopeJumping || !IsOnSlope))
                {
                    //jumping
                    if (MappedInput.GetButtonDown(DefaultControls.Jump))
                    {
                        var   jumpVelocity  = JumpInstantaneousVelocity * RpgValues.GetJumpVelocityMultiplier(playerModel) * ConfigState.Instance.GetGameplayConfig().Difficulty.PlayerAgility;
                        float jumpEnergyUse = RpgValues.GetJumpEnergyUse(playerModel);

                        if (playerModel.Energy >= jumpEnergyUse)
                        {
                            playerModel.Energy -= jumpEnergyUse;
                            bool wasCrouched = IsCrouching;

                            //uncrouch if we were crouched
                            if (wasCrouched)
                            {
                                IsCrouching     = false;
                                DidChangeCrouch = true;
                                SetCrouchState();
                                jumpVelocity += JumpCrouchBoostVelocity;
                            }

                            Velocity += Quaternion.AngleAxis(transform.eulerAngles.y, Vector3.up) * jumpVelocity;
                            CharController.Move(Quaternion.AngleAxis(transform.eulerAngles.y, Vector3.up) * JumpInstantaneousDisplacement);
                            JumpSound.Ref()?.Play();
                            DidJump = true;
                        }
                        else
                        {
                            //failed to jump
                            QdmsMessageBus.Instance.PushBroadcast(new QdmsFlagMessage("RpgInsufficientEnergy"));
                        }
                    }
                }
            }

            //energy recovery
            if (!IsRunning && IsGrounded && !DidJump)
            {
                float energyGain = (IsMoving ? RpgValues.GetMovingEnergyRecoveryRate(playerModel) : RpgValues.GetIdleEnergyRecoveryRate(playerModel)) * Time.deltaTime;
                playerModel.Energy = Mathf.Min(playerModel.DerivedStats.MaxEnergy, playerModel.Energy + energyGain);
            }
        }
        private void HandlePlayerRespawn()
        {
            if (GameEnding) //can't respawn if game is over
            {
                return;
            }

            //countdown dying players
            int deadPlayers = 0;

            foreach (var dpKvp in DyingPlayers)
            {
                if (dpKvp.Value.TimeLeft > 0)
                {
                    dpKvp.Value.TimeLeft -= Time.deltaTime;
                }
                else
                {
                    deadPlayers++;
                }
            }

            //handle ALL players dead
            if (deadPlayers == Players.Length)
            {
                GameEnding       = true;
                EndGameCoroutine = StartCoroutine(CoEndGame());
            }

            //scan for dead players
            foreach (var player in Players)
            {
                if (player.PlayerIsDead && !DyingPlayers.ContainsKey(player))
                {
                    var countdownGO         = Instantiate(CoreUtils.LoadResource <GameObject>("UI/RespawnCountdown"), CoreUtils.GetUIRoot());
                    var countdownController = countdownGO.GetComponent <CountdownController>();
                    countdownController.SetupCountdown(RespawnTimeout);
                    DyingPlayers.Add(player, new DyingPlayer()
                    {
                        TimeLeft = RespawnTimeout, CountdownController = countdownController
                    });
                }
            }

            //resurrect dead players if requested
            //note that we'll never actually destroy the player objects so we can simply resurrect them
            //note that this is set up for two players instead of n players

            if (MappedInput.GetButtonDown("Start") && MetaState.Instance.Player1Credits >= 1 && Players.Length >= 1 && Players[0] != null && DyingPlayers.ContainsKey(Players[0]) && DyingPlayers[Players[0]].TimeLeft > 0)
            {
                var dp = DyingPlayers[Players[0]];
                DyingPlayers.Remove(Players[0]);
                Destroy(dp.CountdownController.gameObject);
                Players[0].Resurrect();
                Players[0].SetSpawnInvulnerability(SpawnInvulnerability);
                Players[0].Bombs = SpawnBombs;
                MetaState.Instance.Player1Credits--;
            }

            /*
             * if (MappedInput.GetButtonDown("StartP2") && MetaState.Instance.Player2Credits >= 1 && Players.Length >= 2 && Players[1] != null && DyingPlayers.ContainsKey(Players[1]) && DyingPlayers[Players[1]].TimeLeft > 0)
             * {
             *  var dp = DyingPlayers[Players[1]];
             *  DyingPlayers.Remove(Players[1]);
             *  Destroy(dp.CountdownController.gameObject);
             *  Players[1].Resurrect();
             *  Players[1].SetSpawnInvulnerability(SpawnInvulnerability);
             *  Players[1].Bombs = SpawnBombs;
             *  MetaState.Instance.Player2Credits--;
             * }
             */
        }
예제 #29
0
        /// <summary>
        /// Handle noclip state and movement
        /// </summary>
        protected void HandleNoclip()
        {
            if (!Clipping && !(MetaState.Instance.SessionFlags.Contains("NoClip") || GameState.Instance.PlayerFlags.Contains(PlayerFlags.NoClip)))
            {
                exitNoclipMode();
                return;
            }
            else if (Clipping && (MetaState.Instance.SessionFlags.Contains("NoClip") || GameState.Instance.PlayerFlags.Contains(PlayerFlags.NoClip)))
            {
                enterNoclipMode();
                return;
            }

            if (!Clipping)
            {
                doNoclipMovement();
            }

            void enterNoclipMode()
            {
                Clipping = false;

                IsMoving   = false;
                IsRunning  = false;
                IsGrounded = false;
                IsOnSlope  = false;

                IsCrouching = false;
                SetCrouchState();

                CharController.enabled          = false;
                CharController.detectCollisions = false;
            }

            void exitNoclipMode()
            {
                Clipping = true;

                CharController.enabled          = true;
                CharController.detectCollisions = true;
            }

            void doNoclipMovement()
            {
                if (!PlayerController.PlayerInControl || LockPauseModule.IsInputLocked() || GameState.Instance.PlayerFlags.Contains(PlayerFlags.Frozen) || GameState.Instance.PlayerFlags.Contains(PlayerFlags.TotallyFrozen))
                {
                    return;
                }

                Vector3 moveVector = Vector3.zero;
                Vector3 velocity   = MappedInput.GetButton(DefaultControls.Sprint) ? NoclipFastVelocity : NoclipVelocity;

                if (Mathf.Abs(MappedInput.GetAxis(DefaultControls.MoveY)) > InputDeadzone)
                {
                    moveVector += (PlayerController.CameraRoot.transform.forward * MappedInput.GetAxis(DefaultControls.MoveY) * velocity.z * Time.deltaTime);
                }

                if (Mathf.Abs(MappedInput.GetAxis(DefaultControls.MoveX)) > InputDeadzone)
                {
                    moveVector += (transform.right * MappedInput.GetAxis(DefaultControls.MoveX) * velocity.x * Time.deltaTime);
                }

                float moveY = MappedInput.GetAxis(DefaultControls.Jump) - MappedInput.GetAxis(DefaultControls.Crouch);

                if (Mathf.Abs(moveY) > InputDeadzone)
                {
                    moveVector += (Vector3.up * moveY * velocity.y * Time.deltaTime);
                }

                if (moveVector.magnitude > 0)
                {
                    transform.Translate(moveVector, Space.World);
                }
            }
        }
예제 #30
0
 public void OnClickConfigureInput()
 {
     MappedInput.ConfigureMapper();
 }
예제 #31
0
    private void Move(MappedInput input)
    {
        float rangeX = 0f;

        if (input.Ranges.ContainsKey("MoveLeftBat"))
        {
            rangeX = -input.Ranges["MoveLeftBat"];
        }
        else if (input.Ranges.ContainsKey("MoveRightBat"))
        {
            rangeX = input.Ranges["MoveRightBat"];
        }

        if (rangeX >= minMovementRange || rangeX <= -1 * minMovementRange)
        {

            velocityX = Mathf.Clamp(velocityX + velocityFactor * Time.deltaTime * rangeX, minVelocity, maxVelocity);

        }
        // if the joystick is in the deadzone, slow down the character
        else
        {
            if (velocityX > 0)
            {
                velocityX = Mathf.Clamp(velocityX - velocityFactor * 0.5f * Time.deltaTime, 0f, maxVelocity);
            }
            else
            {
                velocityX = Mathf.Clamp(velocityX + velocityFactor * 0.5f * Time.deltaTime, minVelocity, 0f);
            }

        }

        float rangeY = 0f;

        if (input.Ranges.ContainsKey("MoveDownBat"))
        {
            rangeY = -input.Ranges["MoveDownBat"];
        }
        else if (input.Ranges.ContainsKey("MoveUpBat"))
        {
            rangeY = input.Ranges["MoveUpBat"];
        }

        if (rangeY >= minMovementRange || rangeY <= -1 * minMovementRange)
        {
            velocityY = Mathf.Clamp(velocityY + velocityFactor * Time.deltaTime * rangeY, minVelocity, maxVelocity);
        }
        // if the joystick is in the deadzone, slow down the character
        else
        {
            if (velocityY > 0)
            {
                velocityY = Mathf.Clamp(velocityY - velocityFactor * 0.5f * Time.deltaTime, 0f, maxVelocity);
            }
            else
            {
                velocityY = Mathf.Clamp(velocityY + velocityFactor * 0.5f * Time.deltaTime, minVelocity, 0f);
            }
        }

        transform.position = new Vector3(
            transform.position.x + velocityX * Time.deltaTime * 60,
            transform.position.y + velocityY * Time.deltaTime * 60,
            0f
        );
    }
예제 #32
0
    private void HandlePlayerButtons(MappedInput input)
    {
        // No keyboard code (only xbox controllers)

        /*
         * if (this == null) return;
         *
         * if (input.Actions.Contains("Jump"))
         * {
         *  _child.Jump();
         * }
         *
         * if (input.Actions.Contains("Sleep") && _child.Sleep())
         * {
         *  Debug.Log("SLEEPING");
         *  InputManager.Instance.PushActiveContext("Sleeping", (int)PlayerNumber);
         * }
         * else if (input.Actions.Contains("WakeUp"))
         * {
         *  Debug.Log("AWAKE");
         *  _child.WakeUp();
         *  InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
         * }*/

        if (this == null)
        {
            return;
        }

        if (input.PlayerIndex == 3)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                _child.Jump();
            }

            if (Input.GetKeyDown(KeyCode.X) && !_child.IsSleeping && _child.Sleep())
            {
                Debug.Log("SLEEPING");
                InputManager.Instance.PushActiveContext("Sleeping", (int)PlayerNumber);
            }
            else if (Input.GetKeyDown(KeyCode.X) && _child.IsSleeping)
            {
                Debug.Log("AWAKE");
                _child.WakeUp();
                InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
            }
        }
        else
        {
            if (input.Actions.Contains("Jump"))
            {
                _child.Jump();
            }

            if (input.Actions.Contains("Sleep") && _child.Sleep())
            {
                Debug.Log("SLEEPING");
                InputManager.Instance.PushActiveContext("Sleeping", (int)PlayerNumber);
            }
            else if (input.Actions.Contains("WakeUp"))
            {
                Debug.Log("AWAKE");
                _child.WakeUp();
                InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
            }
        }
    }
예제 #33
0
    private void HandleMenuInput(MappedInput input)
    {
        bool acceptButtonPressed = input.Actions.Contains("Confirm");
        bool backButonPressed = input.Actions.Contains("Cancel");
        float verticalAxis = 0f;

        if (input.Ranges.ContainsKey("MoveUpMenu"))
        {
            verticalAxis = input.Ranges["MoveUpMenu"];
        }
        else if (input.Ranges.ContainsKey("MoveDownMenu"))
        {
            verticalAxis = -input.Ranges["MoveDownMenu"];
        }

        MenusManager.Instance.SetInputValues(acceptButtonPressed, backButonPressed, 0f, verticalAxis);
    }
예제 #34
0
        private void HandleInteraction()
        {
            //get thing, probe and display tooltip, check use

            bool haveTarget = false;

            int layerMask = LayerMask.GetMask("Default", "ActorHitbox", "Actor");

            Debug.DrawRay(CameraRoot.position, CameraRoot.transform.forward * MaxProbeDist);

            //raycast all, go through the hits ignoring hits to self
            RaycastHit[] hits = Physics.RaycastAll(CameraRoot.transform.position, CameraRoot.transform.forward, MaxProbeDist * 2, layerMask, QueryTriggerInteraction.Collide);
            if (hits != null && hits.Length > 0)
            {
                //GameObject nearestObject = null;
                InteractableComponent nearestInteractable = null;
                float nearestDist = float.MaxValue;
                foreach (RaycastHit hit in hits)
                {
                    //skip if it's further than nearestDist (occluded) or flatdist is further than MaxProbeDist (too far away)
                    if (hit.distance > nearestDist)
                    {
                        continue;
                    }

                    float fDist = VectorUtils.GetFlatVectorToTarget(transform.position, hit.point).magnitude;
                    if (fDist > MaxProbeDist)
                    {
                        continue;
                    }

                    //nearestObject = hit.collider.gameObject;

                    //if there's a PlayerController attached, we've hit ourselves
                    if (hit.collider.GetComponent <PlayerController>() != null)
                    {
                        continue;
                    }

                    //TODO pull a similar trick to see if we're pointing at an Actor?

                    //get the interactable component and hitbox component; if it doesn't have either then it's an obstacle
                    InteractableComponent ic  = hit.collider.GetComponent <InteractableComponent>();
                    IHitboxComponent      ahc = hit.collider.GetComponent <IHitboxComponent>();
                    if (ic == null && ahc == null)
                    {
                        //we null out our hit first since it's occluded by this one
                        nearestInteractable = null;
                        nearestDist         = hit.distance;
                        continue;
                    }

                    //it's just us lol
                    if (ahc != null && ahc.ParentController is PlayerController)
                    {
                        continue;
                    }

                    //we have an interactablecomponent and we're not occluded
                    if (ic != null)
                    {
                        nearestInteractable = ic;
                        nearestDist         = hit.distance;
                        continue;
                    }

                    //if it doesn't meet any of those criteria then it's an occluder
                    nearestInteractable = null;
                    nearestDist         = hit.distance;
                }

                //if(nearestObject != null)
                //    Debug.Log("Nearest: " + nearestObject.name);

                if (nearestInteractable != null && nearestInteractable.enabled)
                {
                    //Debug.Log("Detected: " + nearestInteractable.Tooltip);

                    //HUDScript.SetTargetMessage(nearestInteractable.Tooltip);
                    nearestInteractable.OnLook(this.gameObject);
                    if (!string.IsNullOrEmpty(nearestInteractable.Tooltip))
                    {
                        MessageInterface.PushToBus(new QdmsKeyValueMessage("PlayerHasTarget", "Target", nearestInteractable.Tooltip));
                        HadTargetLastFrame = true;
                        haveTarget         = true;
                    }

                    //actual use
                    if (MappedInput.GetButtonDown(DefaultControls.Use) && !GameState.Instance.PlayerFlags.Contains(PlayerFlags.NoInteract))
                    {
                        nearestInteractable.OnActivate(this.gameObject);
                    }
                }
            }

            if (!haveTarget && HadTargetLastFrame)
            {
                MessageInterface.PushToBus(new QdmsFlagMessage("PlayerClearTarget")); //should probably not do this constantly
            }

            HadTargetLastFrame = haveTarget;
        }
예제 #35
0
    private void HandleMenuInput(MappedInput input)
    {
        float yAxis = 0f;

        if (input.Ranges.ContainsKey("SelectOptionUp"))
        {
            yAxis = input.Ranges["SelectOptionUp"];
        }
        else if (input.Ranges.ContainsKey("SelectOptionDown"))
        {
            yAxis = -input.Ranges["SelectOptionDown"];
        }

        bool accept = input.Actions.Contains("Accept");

        MenusManager.Instance.SetInputValues(accept, false, 0f, yAxis);
    }
예제 #36
0
    private void HandleGameplayInput(MappedInput input)
    {
        if (_levelIndex >= FIRST_PLAYABLE_LEVEL_INDEX && input.Actions.Contains("Start") && !_isPaused)
        {
            MenusManager.Instance.ShowMenu("PauseMenu");

            // TODO: Maybe put it in a "eat input" method in the InputMapper???
            input.Actions.Remove("Start");
        }
    }
예제 #37
0
    private void HandlePlayerAxis(MappedInput input)
    {
        // No keyboard code (only xbox controllers)
        if (this == null || !_child.Mom.StartGame)
        {
            return;
        }

        // movement

        float xValue = 0f;

        if (input.Ranges.ContainsKey("MoveLeft"))
        {
            xValue = -input.Ranges["MoveLeft"];
        }
        else if (input.Ranges.ContainsKey("MoveRight"))
        {
            xValue = input.Ranges["MoveRight"];
        }

        float zValue = 0f;

        if (input.Ranges.ContainsKey("MoveForward"))
        {
            zValue = input.Ranges["MoveForward"];
        }
        else if (input.Ranges.ContainsKey("MoveBackward"))
        {
            zValue = -input.Ranges["MoveBackward"];
        }

        _child.Move(xValue, zValue);

        // targeting

        float xLookingValue = 0f;

        if (input.Ranges.ContainsKey("LookLeft"))
        {
            xLookingValue = -input.Ranges["LookLeft"];
        }
        else if (input.Ranges.ContainsKey("LookRight"))
        {
            xLookingValue = input.Ranges["LookRight"];
        }

        float zLookingValue = 0f;

        if (input.Ranges.ContainsKey("LookForward"))
        {
            zLookingValue = input.Ranges["LookForward"];
        }
        else if (input.Ranges.ContainsKey("LookBackward"))
        {
            zLookingValue = -input.Ranges["LookBackward"];
        }

        if (xLookingValue != 0 || zLookingValue != 0)
        {
            transform.eulerAngles = new Vector3(
                transform.eulerAngles.x,
                Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg - 90,     // -90 to correct forward facing angle...
                transform.eulerAngles.z);
        }
        else
        {
            // if player is not look with the right joystick, then face the direction we're going
            // if left joystick is used, else we don't change the facing direction
            if (xValue != 0 || zValue != 0)
            {
                transform.eulerAngles = new Vector3(
                    transform.eulerAngles.x,
                    Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg - 90,
                    transform.eulerAngles.z);
            }
        }

        if (input.Ranges.ContainsKey("Throw"))
        {
            _child.Throw();
        }

        if (input.Actions.Contains("Hit"))
        {
            _child.Swing();
        }



        // Keyboard + mouse code (for the fourth player)

        /*if (this == null || !_child.Mom.StartGame) return;
         *
         * float xValue = 0f;
         * float zValue = 0f;
         * float xLookingValue = 0f;
         * float zLookingValue = 0f;
         *
         * bool throwPressed = false;
         * bool hitPressed = false;
         *
         * if (input.PlayerIndex == 3)
         * {
         *  if (Input.GetKey(KeyCode.A))
         *  {
         *      xValue = -1f;
         *  }
         *  else if (Input.GetKey(KeyCode.D))
         *  {
         *      xValue = 1f;
         *  }
         *
         *  if (Input.GetKey(KeyCode.W))
         *  {
         *      zValue = 1f;
         *  }
         *  else if (Input.GetKey(KeyCode.S))
         *  {
         *      zValue = -1f;
         *  }
         *
         *  Vector3 mousePos = Input.mousePosition;
         *
         *  mousePos.z = Vector3.Distance(new Vector3(0f, transform.position.y, 0f), Camera.main.transform.position);
         *
         *  Vector3 mouseWorldPos = Camera.main.ScreenToWorldPoint(mousePos);
         *
         *  Vector3 relAxis = (new Vector3(mouseWorldPos.x, transform.position.y, mouseWorldPos.z) - transform.position).normalized;
         *
         *  xLookingValue = relAxis.x;
         *  zLookingValue = relAxis.z;
         *
         *  // targeting
         *
         *  if (xLookingValue != 0 || zLookingValue != 0)
         *  {
         *
         *      transform.eulerAngles = new Vector3(
         *              transform.eulerAngles.x,
         *              Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg, // -90 to correct forward facing angle...
         *              transform.eulerAngles.z);
         *
         *  }
         *  else
         *  {
         *
         *      // if player is not look with the right joystick, then face the direction we're going
         *      // if left joystick is used, else we don't change the facing direction
         *      if (xValue != 0 || zValue != 0)
         *      {
         *          transform.eulerAngles = new Vector3(
         *              transform.eulerAngles.x,
         *              Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg,
         *              transform.eulerAngles.z);
         *      }
         *  }
         *
         *  throwPressed = Input.GetKeyDown(KeyCode.Mouse0);
         * }
         * else
         * {
         *  if (input.Ranges.ContainsKey("MoveLeft"))
         *  {
         *      xValue = -input.Ranges["MoveLeft"];
         *  }
         *  else if (input.Ranges.ContainsKey("MoveRight"))
         *  {
         *      xValue = input.Ranges["MoveRight"];
         *  }
         *
         *  if (input.Ranges.ContainsKey("MoveForward"))
         *  {
         *      zValue = input.Ranges["MoveForward"];
         *  }
         *  else if (input.Ranges.ContainsKey("MoveBackward"))
         *  {
         *      zValue = -input.Ranges["MoveBackward"];
         *  }
         *
         *  if (input.Ranges.ContainsKey("LookLeft"))
         *  {
         *      xLookingValue = -input.Ranges["LookLeft"];
         *  }
         *  else if (input.Ranges.ContainsKey("LookRight"))
         *  {
         *      xLookingValue = input.Ranges["LookRight"];
         *  }
         *
         *  if (input.Ranges.ContainsKey("LookForward"))
         *  {
         *      zLookingValue = input.Ranges["LookForward"];
         *  }
         *  else if (input.Ranges.ContainsKey("LookBackward"))
         *  {
         *      zLookingValue = -input.Ranges["LookBackward"];
         *  }
         *
         *  // targeting
         *
         *  if (xLookingValue != 0 || zLookingValue != 0)
         *  {
         *
         *      transform.eulerAngles = new Vector3(
         *              transform.eulerAngles.x,
         *              Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg - 90, // -90 to correct forward facing angle...
         *              transform.eulerAngles.z);
         *
         *  }
         *  else
         *  {
         *
         *      // if player is not look with the right joystick, then face the direction we're going
         *      // if left joystick is used, else we don't change the facing direction
         *      if (xValue != 0 || zValue != 0)
         *      {
         *          transform.eulerAngles = new Vector3(
         *              transform.eulerAngles.x,
         *              Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg - 90,
         *              transform.eulerAngles.z);
         *      }
         *  }
         *
         *  throwPressed = input.Ranges.ContainsKey("Throw");
         *  hitPressed = input.Actions.Contains("Hit");
         * }
         *
         * _child.Move(xValue, zValue);
         *
         * if (throwPressed)
         *  _child.Throw();
         *
         * if (hitPressed)
         *              _child.Swing();*/
    }