コード例 #1
0
        void LoadDefault()
        {
            //SceneNode navmeshNode = new SceneNode();
            //navmeshNode.Name = "NavMesh";
            //var test = (TestScript)navmeshNode.AddComponent<TestScript>();
            //Scene.AddNode2Root(navmeshNode);
            //test.camera = camera;
            //Button = test;
            var cameraNode = CoreEngine.GetCamera.Node;
            var playerNode = new SceneNode();

            playerNode.Name = "Player";
            playerNode.GetTransform.Position = new Vector3(0, 0.5f, 0);
            cameraNode.GetTransform.Position = new Vector3(0, 2.14f, 0);
            CoreEngine.MainScene.AddNode2Root(playerNode);
            playerNode.AddComponent <CharacterControllPlayer>();

            cameraNode.SetParent(playerNode);

            cameraNode.AddComponent <CameraPOVScript>();

            var audioListener = AudioListener.GetListener();

            cameraNode.AddComponent(audioListener);
            //load ui
            uiScript    = Node.AddComponent <LoadUIScript>();
            uiScript.cc = cc;


            /*
             * var rhand = new SceneNode();
             * rhand.Name = "Lhand";
             * var size = new Vector3(0.23f, 0.23f, 0.25f);
             * rhand.AddComponent(Toys.Debug.TestBox.CreateBox(size));
             * rhand.GetTransform.Position = new Vector3(0, 2, -1f);
             * var physBox = rhand.AddComponent<Toys.Physics.RigitBodyBox>();
             * physBox.Size = size;
             * //physBox.Mass = 1;
             * physBox.IsKinematic = true;
             * physBox.SetFlags(-1, -1);
             * //CoreEngine.MainScene.AddNode2Root(rhand);
             * rhand.SetParent(CoreEngine.GetCamera.Node.Parent);
             */
        }