public void OnRTrigger(CallbackContext context)
 {
     if (mover != null)
     {
         if (context.ReadValue <float>() > 0f)           //onPressed (this could run an unknown amount of times)
         {
             if (rightTriggerAlreadySuppressed == false) //used to make sure the action only runs once until this trigger is released
             {
                 if (mover.hasBall == true)              //if they DO have the ball then start charging
                 {
                     mover.ChargeThrow();                //start charging
                 }
                 else //if they DONT have the ball then do nothing? (potentially make this shield)
                 {
                 }
             }
             rightTriggerAlreadySuppressed = true;
         }
         else if (context.ReadValue <float>() == 0f)                     //onRelease
         {
             if (mover.hasBall == true && mover.hasChargedThrow == true) //if they DO have the ball AND have already started charging a throw then release the throw
             {
                 mover.ThrowBall();
             }
             else //if they DONT have the ball then do nothing? need to factor in the possibility that the ball has been stolen since they started charging
             {
             }
             rightTriggerAlreadySuppressed = false;
         }
     }
 }
    public void OnMove(CallbackContext context)
    {
        if (Selector != null)
        {
            Selector.x1 += context.ReadValue <Vector2>().x;
            Selector.y1 += context.ReadValue <Vector2>().y *-1;
            if (Selector.y1 > 1)
            {
                Selector.y1 = 1;
            }
            else if (Selector.y1 < 0)
            {
                Selector.y1 = 0;
            }

            if (Selector.x1 > 2)
            {
                Selector.x1 = 2;
            }
            else if (Selector.x1 < 0)
            {
                Selector.x1 = 0;
            }

            Selector.ChangeSelectedCharacter();
        }
    }
Esempio n. 3
0
        public void MoveInput(CallbackContext ctx)
        {
            if (ctx.performed)
            {
                if (ctx.valueType.ToString() == "System.Single")
                {
                    previousInputFloat = ctx.ReadValue <float>();
                    if (!Axis)
                    {
                        Axis = true;
                    }
                }
                else if (ctx.valueType.ToString() == "UnityEngine.Vector2")
                {
                    previousInputVector2 = ctx.ReadValue <Vector2>();
                    if (!Vector2)
                    {
                        Vector2 = true;
                    }
                }
                return;
            }

            if (ctx.canceled)
            {
                previousInputFloat   = 0f;
                previousInputVector2 = UnityEngine.Vector2.zero;
            }
        }
    public void HandleMoveInput(CallbackContext context)
    {
        if (context.performed)
        {
            _direction = context.ReadValue <Vector2>();
        }
        if (context.canceled)
        {
            _direction = context.ReadValue <Vector2>();
        }

        if (isMovementRelativeToCamera)
        {
            Vector3 forwardDirection = cameraReference.transform.forward * _direction.y;
            forwardDirection.y = 0;
            Vector3 rightDirection = cameraReference.transform.right * _direction.x;
            rightDirection.y = 0;

            _direction = forwardDirection + rightDirection;
            _direction = _direction.normalized;
        }
        else
        {
            _direction = new Vector3(_direction.x, _direction.z, _direction.y);
        }
    }
    public void OnLBumper(CallbackContext context) //this is coded a bit shit; currently it is forced for Drop Ball and Gather Ball to be mapped to the same button, potentially move sorting logic into Mover class or another class
    {
        pressLBCounter++;

        //Debug.Log("LB presses: " + pressCounterLB.ToString());
        if (mover != null)
        {
            if (pressLBCounter == 1) //onEntered: when button is first pressed
            {
                //do nothing?
            }
            if (pressLBCounter == 2)       //onPressed: when button is first pressed but after onEntered; if you hold down button it wont do anything further until released
            {
                if (mover.hasBall == true) //if they DO have the ball then release it
                {
                    mover.DropBall();
                }
                else //if they DONT have the ball then set isGathering to true; the gatherCollider will then automatically pick it up
                {
                    mover.SetIsGathering(context.ReadValue <float>());
                }
            }
            if (pressLBCounter == 3) //onRelease: when button is released
            {
                //if they DONT have the ball then set isGathering to false
                mover.SetIsGathering(context.ReadValue <float>());
                pressLBCounter = 0; //on release prep it so the next press takes them to onEntered again
            }
        }
    }
 public void OnMove(CallbackContext movementContext)
 {
     if (playerMovement != null)
     {
         // Takes the input from object this script is attached to (PlayerInputController)
         playerMovement.SetInputVector(movementContext.ReadValue <Vector2>());
         playerCombat.SetInputAimVector(movementContext.ReadValue <Vector2>());
     }
 }
Esempio n. 7
0
 public void MotherAction(CallbackContext cc)
 {
     if (cc.ReadValue <float>() == 1.0f && !actionButtonClicked)
     {
         actionButtonClicked = true;
         myIO?.OnPlayerAction(Actor.MOTHER);
     }
     else if (cc.ReadValue <float>() == 0.0f && actionButtonClicked)
     {
         actionButtonClicked = false;
     }
 }
Esempio n. 8
0
    public void OnMove(CallbackContext ctx)
    {
        movm = ctx.ReadValue <Vector2>();
        Debug.Log("on drag inside " + movm);


        Vector2 v = ctx.ReadValue <Vector2>();

        message.x = Convert.ToInt16(v.x * 100f);
        message.y = Convert.ToInt16(v.y * 100f);

        sendMoveMessage();
    }
Esempio n. 9
0
    // // Start is called before the first frame update
    // void Start()
    // {

    // }

    // Update is called once per frame
    // void Update()
    // {
    //     var index = playerInput.playerIndex;
    //     print("inx:"+index);
    // }

    public void OnMove(CallbackContext context)
    {
        if (player1 != null && player2 != null)
        {
            if (index == 0)
            {
                player1.SetInputVector(context.ReadValue <Vector2>());
            }
            else
            {
                player2.SetInputVector(context.ReadValue <Vector2>());
            }
        }
    }
Esempio n. 10
0
    public void HandleCameraInput(CallbackContext context)
    {
        if (_canReadCameraInput)
        {
            if (context.performed)
            {
                _direction = context.ReadValue <Vector2>().normalized;
            }

            if (context.canceled)
            {
                _direction = context.ReadValue <Vector2>().normalized;
            }
        }
    }
Esempio n. 11
0
    public void OnMoveInput(CallbackContext context)
    {
        RawMovementInput = context.ReadValue <Vector2>();

        NormalizedInputX = Mathf.Abs(RawMovementInput.x) > 0.5f ? (int)(RawMovementInput * Vector2.right).normalized.x : 0;
        NormalizedInputY = Mathf.Abs(RawMovementInput.y) > 0.5f ? (int)(RawMovementInput * Vector2.up).normalized.y : 0;
    }
Esempio n. 12
0
 public void OnLook(CallbackContext callback)
 {
     if (PlayerController != null)
     {
         PlayerController.Look(callback.ReadValue <Vector2>());
     }
 }
Esempio n. 13
0
        private void OnScroll(CallbackContext ctx)
        {
            // scroll through hotbar
            float scroll = ctx.ReadValue <Vector2>().y;

            if (IsToolBarSelected)
            {
                if (scroll > 0)
                {
                    PreviousTool();
                }
                else
                {
                    NextTool();
                }
            }
            else
            {
                if (scroll > 0)
                {
                    PreviousFunction();
                }
                else
                {
                    NextFunction();
                }
            }
        }
Esempio n. 14
0
 public void OnMove(CallbackContext context)
 {
     if (playerMovement != null)
     {
         playerMovement.SetInputVector(context.ReadValue <Vector2>());
     }
 }
Esempio n. 15
0
 public void OnReverse(CallbackContext context)
 {
     if (mover != null && game.gameState == GameStates.RoundPlay)
     {
         mover.reverse = context.ReadValue <float>();
     }
 }
        public void Rotate(CallbackContext ctx)
        {
            if (!ctx.performed)
            {
                return;
            }

            RaycastHit hit;
            var        aimInput = ctx.ReadValue <Vector2>();

            aim = Camera.main.ScreenPointToRay(aimInput);
            Vector3 mousePosition = aimInput;

            mousePosition.y          += offset;
            mousePosition.z           = distance;
            cursor.transform.position = Camera.main.ScreenToWorldPoint(mousePosition);

            if (Physics.Raycast(aim, out hit, Mathf.Infinity))
            {
                float finalOffset;
                finalOffset = (transform.position - hit.point).magnitude * offset;
                cursor.transform.position = new Vector3(cursor.transform.position.x, cursor.transform.position.y + finalOffset, cursor.transform.position.z);
                transform.LookAt(cursor.transform);
            }
            else
            {
                transform.LookAt(cursor.transform);
            }
        }
Esempio n. 17
0
 public void OnMove(CallbackContext context)
 {
     if (movement != null)
     {
         movement.SetMovement(context.ReadValue <Vector2>());
     }
 }
Esempio n. 18
0
    public void ScrollItem(CallbackContext ctx)
    {
        if (!ctx.performed)
        {
            return;
        }

        short scrollDirection = (short)(ctx.ReadValue <float>() > 0 ? 1 : -1);

        ActiveSlot += scrollDirection;
        if (ActiveSlot >= TotalSlots)
        {
            ActiveSlot = 0;
        }
        else if (ActiveSlot < 0)
        {
            ActiveSlot = TotalSlots - 1;
        }

        SlotStateChangeEventArgs eventArgs = new SlotStateChangeEventArgs()
        {
            InventoryObject = items[ActiveSlot],
            SlotIndex       = ActiveSlot
        };

        ActiveSlotChanged?.Invoke(this, eventArgs);
    }
Esempio n. 19
0
        public void OnNavigate(CallbackContext value)
        {
            if (value.phase != InputActionPhase.Started ||
                currentEvent.eventType != ScenimaticEvent.ScenimaticEventType.Query)
            {
                return;
            }

            Vector2 direction = value.ReadValue <Vector2>();

            if (direction.x > InputNavigationThreshold)
            {
                queryPanel.NavigateRight();
            }
            else if (direction.x < -InputNavigationThreshold)
            {
                queryPanel.NavigateLeft();
            }
            if (direction.y > InputNavigationThreshold)
            {
                queryPanel.NavigateUp();
            }
            else if (direction.y < -InputNavigationThreshold)
            {
                queryPanel.NavigateDown();
            }
        }
Esempio n. 20
0
        private void OnMove(CallbackContext ctx)
        {
            if (dpadMovement || isPinning(state))
            {
                return;
            }

            Vector2 input = ctx.ReadValue <Vector2>().normalized;

            if (input != Vector2.zero)
            {
                leftStickMovement = true;
            }
            else
            {
                leftStickMovement = false;
            }

            this.inputDirection = CalculateInputAngle(input.x, input.y);

//			Debug.Log($"inputDirection={inputDirection.ToString()}");

//			Vector2 clampedVector = PixelClamp(RawVector(input));
            Vector2 clampedVector = RawVector(input);

            this.move.x += clampedVector.x;
            this.move.y += clampedVector.y;
        }
Esempio n. 21
0
        public void MoveInput(CallbackContext ctx)
        {
            if (ctx.control is KeyControl)
            {
                var key = (KeyControl)ctx.control;
                isX = isY = isZ = false;
                if (key.keyCode == YNegative || key.keyCode == YPositive)
                {
                    isY = true;
                }
                else if (key.keyCode == ZNegative || key.keyCode == ZPositive)
                {
                    isZ = true;
                }
                else
                {
                    isX = true;
                }
            }

            if (ctx.performed)
            {
                previousInput = ctx.ReadValue <float>();
                return;
            }

            if (ctx.canceled)
            {
                previousInput = 0f;
            }
        }
Esempio n. 22
0
    public void CamControl(CallbackContext context)
    {
        var inputs = context.ReadValue <Vector2>();

        if (inputs.x < 0)
        {
            inputs.x = -1;
        }
        else if (inputs.x > 0)
        {
            inputs.x = 1;
        }
        if (inputs.y < 0)
        {
            inputs.y = -1;
        }
        else if (inputs.y > 0)
        {
            inputs.y = 1;
        }
        _playerScript.torsoTwistY = inputs.x;
        _playerScript.torsoTwistX = inputs.y;

        camInputs = inputs;
    }
Esempio n. 23
0
 private void OnMouseMove(CallbackContext context)
 {
     mouseMove = context.ReadValue <Vector2>();
     //print(context.ReadValue<float>());
     X_rot -= mouseMove.y;
     Y_rot += mouseMove.x;
 }
Esempio n. 24
0
 public void OnMove(CallbackContext context)
 {
     if (player != null)
     {
         player.i_movement.y = context.ReadValue <float>();
     }
 }
 //Function that is called by controller
 public void OnMove(CallbackContext context)
 {
     if (mover != null)
     {
         mover.SetInputVector(context.ReadValue <Vector2>()); //Tells the mover script what value the stick motion is returning and saves it to be used later
     }
 }
Esempio n. 26
0
 public void OnMove(CallbackContext context)
 {
     if (_playerController1 != null)
     {
         _playerController1.SetInputVector(context.ReadValue <Vector2>());
     }
 }
Esempio n. 27
0
 public void move(CallbackContext cc)
 {
     if (!block)
     {
         if (!Move)
         {
             Move = true;
         }
         InputValue = cc.ReadValue <float>();
         if (InputValue < 0 && !mySR.flipX)
         {
             myBX.offset = new Vector2(-myBX.offset.x, myBX.offset.y);
             mySR.flipX  = true;
         }
         else if (InputValue > 0 && mySR.flipX)
         {
             myBX.offset = new Vector2(-myBX.offset.x, myBX.offset.y);
             if (!PushPullB)
             {
                 mySR.flipX = false;
             }
         }
         if (PushPullB)
         {
             mySR.flipX = true;
         }
     }
 }
Esempio n. 28
0
 public void OnMove(CallbackContext context)
 {
     if (mover != null)
     {
         mover.SetInputVector(context.ReadValue <Vector2>());
     }
 }
Esempio n. 29
0
 public void InputManager_Player_Move(CallbackContext context)
 {
     if (context.performed)
     {
         Vector2 val = context.ReadValue <Vector2>();
         CustomEvent.Trigger(gameObject, context.action.name, val);
     }
 }
Esempio n. 30
0
 public void MoveInput(CallbackContext context)
 {
     if (!_acceptInput)
     {
         return;
     }
     MoveInput(context.ReadValue <Vector2>());
 }