Пример #1
0
    public void OnUndo(InputAction.CallbackContext c)
    {
        if (c.ReadValueAsButton() && !_onUndo && !moving && Physics.IsEnabled)
        {
            DoUndo();
        }

        _onUndo = c.ReadValueAsButton();
    }
Пример #2
0
    public void OnDebug(InputAction.CallbackContext c)
    {
        if (c.ReadValueAsButton() && !_onDebug)
        {
            enabled = !enabled;
        }

        _onDebug = c.ReadValueAsButton();
    }
Пример #3
0
    public void OnPause(InputAction.CallbackContext c)
    {
        if (c.ReadValueAsButton() && !_onPause)
        {
            TogglePause();
        }

        _onPause = c.ReadValueAsButton();
    }
Пример #4
0
    public void OnRestart(InputAction.CallbackContext c)
    {
        if (c.ReadValueAsButton() && !_onRestart && !moving && Physics.IsEnabled)
        {
            DoRestart();
        }

        _onRestart = c.ReadValueAsButton();
    }
Пример #5
0
    public void OnCheat2(InputAction.CallbackContext c)
    {
        if (c.ReadValueAsButton() && !_onCheat2 && !moving && playerPhysics.IsEnabled)
        {
            GoToLevel(currentIndex - 1, false);
        }

        _onCheat2 = c.ReadValueAsButton();
    }
Пример #6
0
    public void OnShoot2(InputAction.CallbackContext context)
    {
        if (mover != null && context.started)
        {
            button = context.ReadValueAsButton();
        }


        if (mover != null && context.canceled)
        {
            button = context.ReadValueAsButton();
            mover.CancelBullet2();
        }
    }
 public void OnSprint(InputAction.CallbackContext context)
 {
     if (inputUser.controlScheme.ToString() == "DualJoyCon()")
     {
         if (context.control.device == JoyConRight)
         {
             sprintPressed = context.ReadValueAsButton();
         }
     }
     else if (inputUser.controlScheme.ToString() == "ProController(<SwitchProControllerHID>)")
     {
         sprintPressed = context.ReadValueAsButton();
     }
 }
Пример #8
0
 private void Input_onActionTriggered(InputAction.CallbackContext obj)
 {
     if (obj.action.name == controls.InGame.Control.name)
     {
         player.updateMovement(obj.ReadValue <Vector2>());
     }
     else if (obj.action.name == controls.InGame.Boost.name)
     {
         player.updateBoost(obj.ReadValueAsButton());
     }
     else if (obj.action.name == controls.InGame.Action.name)
     {
         player.updateAction(obj.ReadValueAsButton());
     }
 }
 public void OnJump(InputAction.CallbackContext context)
 {
     if (inputUser.controlScheme.ToString() == "DualJoyCon()")
     {
         if (context.control.device == JoyConRight)
         {
             jumpPressed = context.ReadValueAsButton();
         }
     }
     else if (inputUser.controlScheme.ToString() == "ProController(<SwitchProControllerHID>)")
     {
         //Debug.LogAssertion("Jump Pressed from Pro");
         jumpPressed = context.ReadValueAsButton();
     }
 }
Пример #10
0
 void OnCancelClick(InputAction.CallbackContext context)
 {
     if (context.ReadValueAsButton() && context.phase == InputActionPhase.Performed)
     {
         HideTopMenu();
     }
 }
Пример #11
0
    protected virtual void CheckOpenContextMenuFromInputAction(InputAction.CallbackContext context)
    {
        if (Pointer.current == null ||
            !context.ReadValueAsButton() ||
            IsDrag ||
            Touch.activeTouches.Count >= 2)
        {
            return;
        }

        Vector2 position = new Vector2(Pointer.current.position.x.ReadValue(), Pointer.current.position.y.ReadValue());

        if (!RectTransformUtility.RectangleContainsScreenPoint(RectTransform, position))
        {
            return;
        }

        if (graphicRaycaster != null && eventSystem != null)
        {
            List <RaycastResult> raycastResults   = new List <RaycastResult>();
            PointerEventData     pointerEventData = new PointerEventData(eventSystem);
            pointerEventData.position = position;
            graphicRaycaster.Raycast(pointerEventData, raycastResults);
            if (raycastResults.FirstOrDefault().gameObject != this.gameObject)
            {
                // ContextMenu opened on some other element
                return;
            }
        }

        OpenContextMenu(position);
    }
Пример #12
0
 public void OnShoot(InputAction.CallbackContext ctx)
 {
     if (ctx.ReadValueAsButton())
     {
         _netShoot.Shoot(_motor.facingDirection);
     }
 }
Пример #13
0
 /// <summary>
 /// Reciever for the new input system action call.
 /// </summary>
 /// <param name="context">The context of the input change.</param>
 public void OnButtonAction(InputAction.CallbackContext context)
 {
     if (context.ReadValueAsButton() && !context.performed)
     {
         Listener?.Invoke();
     }
 }
Пример #14
0
 public void OnJumpPressed(InputAction.CallbackContext context)
 {
     //if(context.control.device == jcRight)
     //{
     jumpedPressed = context.ReadValueAsButton();
     //}
 }
Пример #15
0
    private void OnRun(InputAction.CallbackContext context)
    {
        bool runInput = context.ReadValueAsButton();

        runInputEvent.Invoke(runInput);
        //Debug.Log($"Run input: {runInput}");
    }
Пример #16
0
    //Dash input
    public void OnDash(InputAction.CallbackContext context)
    {
        if (canMove && context.ReadValueAsButton() && currentDashTime + dashLength + dashCoolDown < Time.time && !OnWall && !isSliding)
        {
            currentDashTime = Time.time;
            //If no direction dash forward.
            if (inputVector.magnitude == 0)
            {
                GetDirectionLooking();
            }
            else
            {
                GetWishDirection();
            }
            movementVector.y   = 0;
            beforeDashVelocity = movementVector.magnitude;
            isDashing          = true;
            dashParticles.SetActive(true);
            playerLayer      = gameObject.layer;
            gameObject.layer = 9; //Dash Layer
            AkSoundEngine.PostEvent("Dash", gameObject);

            if (currentWeapon.GetComponent <MeleeWeapon>())
            {
                currentWeapon.GetComponent <MeleeWeapon>().DashAttack();
            }
        }
    }
Пример #17
0
 public void OnDodge(InputAction.CallbackContext ctx)
 {
     if (ctx.ReadValueAsButton())
     {
         _motor.Dodge();
     }
 }
Пример #18
0
 public void OnKnife(InputAction.CallbackContext ctx)
 {
     if (ctx.ReadValueAsButton())
     {
         _netStab.Stab(_motor.facingDirection);
     }
 }
Пример #19
0
 public void OnSprintActive(InputAction.CallbackContext context)
 {
     //if(context.control.device == jcRight)
     //{
     isSprinting = context.ReadValueAsButton();
     //}
 }
Пример #20
0
 public void OnAnyInput(InputAction.CallbackContext context)
 {
     if (context.ReadValueAsButton() && !_gameSceneManager.isLoadingScene)
     {
         _gameSceneManager.LoadNextLevel();
     }
 }
Пример #21
0
 public void Attack(InputAction.CallbackContext context)
 {
     if (context.ReadValueAsButton())
     {
         if (canAttack == true && currentUses > 0)
         {
             AudioSingleton.PlaySFX(SoundEffect.SpraySalt);
             this.gameObject.GetComponentInChildren <Animator>().SetTrigger("Attack");
             StartCoroutine("AttackTimeFrame");
             StartCoroutine("AttackCooldown");
             currentUses--;
             if (currentUses == 2)
             {
                 saltThree.SetActive(false);
             }
             else if (currentUses == 1)
             {
                 saltTwo.SetActive(false);
             }
             else
             {
                 saltOne.SetActive(false);
             }
         }
     }
 }
 void Interact(InputAction.CallbackContext context)
 {
     if (context.ReadValueAsButton() && currentInteractable)
     {
         currentInteractable.Interact();
     }
 }
Пример #23
0
 public void MakeCameraMove(InputAction.CallbackContext c)
 {
     if (c.ReadValueAsButton())
     {
         StartCoroutine(MoveCamera());
     }
 }
Пример #24
0
    public void OnFire(InputAction.CallbackContext context)
    {
        bFire = context.ReadValueAsButton();
        //Debug.Log("bFire: " + bFire);

        if (!bFire)
        {
            return;
        }

        if (SnowballThrowerComponent.bSnowballIsReady)
        {
            Debug.Log("Starting ChargeSnowball Coroutine");
            StartCoroutine("ChargeSnowball");
        }
        else if (!SnowballThrowerComponent.bIsCreatingSnowball)
        {
            Debug.Log("Starting Snowball Packing");
            SnowballThrowerComponent.CreateSnowball();
        }
        else
        {
            Debug.Log("Snowball is being created");
        }
    }
 public void Jump(InputAction.CallbackContext context)
 {
     if (!CanJump)
     {
         return;
     }
     _jump = context.ReadValueAsButton();
 }
Пример #26
0
    public void OnShoot(InputAction.CallbackContext ctx)
    {
        //ctx.readvaueasbutton returns true of the button is pressed. wheter the button
        //should be held or tapped is set in teh input controls asset
        //depending on the value, the bool of PlayerShooting class is triggered

        _playerShooting._isActivated = ctx.ReadValueAsButton();
    }
Пример #27
0
 public void Jump(InputAction.CallbackContext context)
 {
     jumpPressed = context.ReadValueAsButton();
     if (isGrounded)
     {
         rb.velocity = new Vector2(rb.velocity.x, playerSettings.jumpHeight);
     }
 }
Пример #28
0
    public void OnJump(InputAction.CallbackContext ctx)
    {
        if (!ctx.ReadValueAsButton() || !IsGrounded())
        {
            return;
        }

        rigidbody.AddForce(data.jumpForce * Vector3.up, ForceMode.Impulse);
    }
Пример #29
0
 public void OnFire(InputAction.CallbackContext context)
 {
     //check if button is pressed and we are not already loading a level
     //Due to to the singleton structure of GameSceneManager it's easy to read and call methods use by getting the instance from anywhere
     if (context.ReadValueAsButton() && !GameSceneManager.Instance.bIsLoadingScene)
     {
         GameSceneManager.Instance.GoToLevel();
     }
 }
Пример #30
0
 public void OnFire(InputAction.CallbackContext ctx)
 {
     _isFire = ctx.ReadValueAsButton();
     if (_isFire)
     {
         _lastAttackTime = Time.time;
         _attackValue++;
     }
 }