Пример #1
0
        private void Swimming()
        {
            if (rpgCharacterController.isSwimming)
            {
                float swimTime = 0.5f;

                if (GUI.Button(new Rect(25, 175, 100, 30), "Swim Up"))
                {
                    swimTimeout = Time.time + swimTime;
                    jumpInput   = Vector3.up;

                    // Override the jump input for a half second to simulate a button press
                    RPGCharacterInputController inputController = rpgCharacterController.GetComponent <RPGCharacterInputController>();
                    if (inputController != null)
                    {
                        inputController.PauseInput(swimTime);
                    }
                }
                if (GUI.Button(new Rect(25, 225, 100, 30), "Swim Down"))
                {
                    swimTimeout = Time.time + swimTime;
                    jumpInput   = Vector3.down;

                    // Override the jump input for a half second to simulate a button press
                    RPGCharacterInputController inputController = rpgCharacterController.GetComponent <RPGCharacterInputController>();
                    if (inputController != null)
                    {
                        inputController.PauseInput(swimTime);
                    }
                }
                if (Time.time < swimTimeout)
                {
                    rpgCharacterController.SetJumpInput(jumpInput);
                }
            }
        }