コード例 #1
0
ファイル: GUIControls.cs プロジェクト: cwj2099/New3dplf
        private void Navigation()
        {
            useNavigation = GUI.Toggle(new Rect(610, 105, 100, 30), useNavigation, "Navigation");

            if (!rpgCharacterController.HandlerExists("Navigation"))
            {
                return;
            }
            if (useNavigation)
            {
                nav.transform.GetChild(0).GetComponent <MeshRenderer>().enabled             = true;
                nav.transform.GetChild(0).GetChild(0).GetComponent <MeshRenderer>().enabled = true;
                RaycastHit hit;
                if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
                {
                    nav.transform.position = hit.point;
                    if (Input.GetMouseButtonDown(0))
                    {
                        rpgCharacterController.StartAction("Navigation", hit.point);
                    }
                }
            }
            else
            {
                if (rpgCharacterController.CanEndAction("Navigation"))
                {
                    nav.transform.GetChild(0).GetComponent <MeshRenderer>().enabled             = false;
                    nav.transform.GetChild(0).GetChild(0).GetComponent <MeshRenderer>().enabled = false;
                    rpgCharacterController.EndAction("Navigation");
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Input abstraction for easier asset updates using outside control schemes.
        /// </summary>
        private void Inputs()
        {
            try {
                inputJump         = Input.GetButtonDown("Jump");
                isJumpHeld        = Input.GetButton("Jump");
                inputLightHit     = Input.GetButtonDown("LightHit");
                inputDeath        = Input.GetButtonDown("Death");
                inputAttackL      = Input.GetButtonDown("AttackL");
                inputAttackR      = Input.GetButtonDown("AttackR");
                inputSwitchUpDown = Input.GetAxisRaw("SwitchUpDown");
                inputAim          = Input.GetAxisRaw("Aim");
                inputAiming       = Input.GetButton("Aiming");
                inputHorizontal   = Input.GetAxisRaw("Horizontal");
                inputVertical     = Input.GetAxisRaw("Vertical");
                inputRoll         = Input.GetButtonDown("L3");

                // Injury toggle.
                if (Input.GetKeyDown(KeyCode.I))
                {
                    if (rpgCharacterController.CanStartAction("Injure"))
                    {
                        rpgCharacterController.StartAction("Injure");
                    }
                    else if (rpgCharacterController.CanEndAction("Injure"))
                    {
                        rpgCharacterController.EndAction("Injure");
                    }
                }
                // Slow time toggle.
                if (Input.GetKeyDown(KeyCode.T))
                {
                    if (rpgCharacterController.CanStartAction("SlowTime"))
                    {
                        rpgCharacterController.StartAction("SlowTime", 0.125f);
                    }
                    else if (rpgCharacterController.CanEndAction("SlowTime"))
                    {
                        rpgCharacterController.EndAction("SlowTime");
                    }
                }
                // Pause toggle.
                if (Input.GetKeyDown(KeyCode.P))
                {
                    if (rpgCharacterController.CanStartAction("SlowTime"))
                    {
                        rpgCharacterController.StartAction("SlowTime", 0f);
                    }
                    else if (rpgCharacterController.CanEndAction("SlowTime"))
                    {
                        rpgCharacterController.EndAction("SlowTime");
                    }
                }
            } catch (System.Exception) { Debug.LogError("Inputs not found!"); }
        }
コード例 #3
0
ファイル: NoJumpSlime.cs プロジェクト: Branco5/DV_Lab5
        private void OnTriggerEnter(Collider collide)
        {
            controller = collide.gameObject.GetComponent <RPGCharacterController>();

            if (controller != null)
            {
                oldJumpHandler = controller.GetHandler("Jump");
                controller.SetHandler("Jump", new SimpleActionHandler(() => {
                    Debug.Log("Can't jump!");
                    controller.EndAction("Jump");
                }, () => { }));
            }
        }
コード例 #4
0
        // Put any code in here you want to run BEFORE the state's update function. This is run regardless of what state you're in.
        protected override void EarlyGlobalSuperUpdate()
        {
            bool acquiringGround   = superCharacterController.currentGround.IsGrounded(false, 0.01f);
            bool maintainingGround = superCharacterController.currentGround.IsGrounded(true, 0.5f);

            if (acquiringGround)
            {
                rpgCharacterController.StartAction("AcquiringGround");
            }
            else
            {
                rpgCharacterController.EndAction("AcquiringGround");
            }

            if (maintainingGround)
            {
                rpgCharacterController.StartAction("MaintainingGround");
            }
            else
            {
                rpgCharacterController.EndAction("MaintainingGround");
            }
        }