コード例 #1
0
 // updates UI
 private void UpdateUI()
 {
     InputManager.Action action = InputManager.GetAction(nameLabel.text);
     keyLabel.text    = action.Key.ToString();
     altKeyLabel.text = action.AltKey.ToString();
 }
コード例 #2
0
    void Update()
    {
        if (!UIManager.updateActive || CutsceneManager.cutsceneActive)
        {
            return;
        }

        InputManager.Action mobileAction = InputManager.GetAction();

        if (_grab.state == Grabber.State.Hold)
        {
            if (mobileAction == InputManager.Action.LightAttack || mobileAction == InputManager.Action.PickupOrGrab)
            {
                _grab.Punch();
            }
            else if (mobileAction == InputManager.Action.HeavyAttack)
            {
                _grab.Throw();
            }
            else if (mobileAction == InputManager.Action.Throw)
            {
                _grab.Throw();
            }
            return;
        }
        if (_grab.state != Grabber.State.Null)
        {
            return;
        }

        if (mobileAction == InputManager.Action.LightAttack)
        {
            _attack.LightAttack();
            justClicked = true;
        }

        if (mobileAction == InputManager.Action.HeavyAttack)
        {
            _attack.HeavyAttack();
        }

        if (mobileAction == InputManager.Action.PickupOrGrab)
        {
            if (_motor.isOnItem)
            {
                justClicked  = true;
                heldComplete = true;
            }
            else
            {
                _grab.StartGrab();
            }
        }

        if (mobileAction == InputManager.Action.Grab)
        {
            _grab.StartGrab();
        }

        if (mobileAction == InputManager.Action.Jump)
        {
            _jump.StartJump();
        }

        if (mobileAction == InputManager.Action.Throw)
        {
            _throw.StartThrow();
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            PerkManager.PerformPerkEffects(Perk.PerkCategory.TRINKET);
        }
    }