コード例 #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");
                }
            }
        }