예제 #1
0
        void ToggleCamera()
        {
            Scene s=Root.Instance.Scene;
                GameCamera oldcam=MainCamera;
                GameCamera newcam;
                Root.Instance.LocalObjects.Remove(oldcam);
                if(oldcam.GetType()==typeof(OverviewCamera))
                {
                    newcam=new TopCamera();
                }
                else if(oldcam.GetType()==typeof(TopCamera))
                {
                    newcam=new IsoCamera();
                }
                else if(oldcam.GetType()==typeof(IsoCamera))
                {
                    newcam=new OverviewCamera();
                }
                else
                    throw new Exception("bug");

                newcam.Target=oldcam.Target;
                Root.Instance.LocalObjects.Add(newcam);
                MainCamera=newcam;
                MainCamera.Aspect = (float)Root.Instance.UserInterface.Renderer.Size.X / (float)Root.Instance.UserInterface.Renderer.Size.Y;
                s.camera=newcam;
        }
예제 #2
0
        public override void Start()
        {
            base.Start();

            Node n;
            Root client = Root.Instance;

            if (Demo != null && Demo != "")
            {
                client.Player = new DemoPlayer(Demo);
                DemoControl dc = new DemoControl();
                dc.Position = new Vector2(0, 40);
                dc.Size = new Vector2(500, 30);
                Root.Instance.Gui.windows.Add(dc);
            }
            else if (!Local)
            {
                Root.Instance.Scene.Clear();
                client.ClientConnect(Host);
            }

            if (Local)
            {
                Root.Instance.Authoritive = true;
                Server.Start();
            }
            MainCamera = new OverviewCamera();
            if (Root.Instance.UserInterface != null)
                MainCamera.Aspect = (float)Root.Instance.UserInterface.Renderer.Size.X / (float)Root.Instance.UserInterface.Renderer.Size.Y;
            Root.Instance.LocalObjects.Add(MainCamera);

            if(Music!=null)
                MusicChannel = MainCamera.PlaySound(Music, true);

            /*if (Spectate)
            {
                Root.Instance.LocalObjects.Add(new Reporter());
            }*/

            Root.Instance.Scene.camera = MainCamera;
            //Root.Instance.Scene.camera2 = FlyByCamera;

            n = new Node();
            //n.Draw.Add(new Cursor(new Color3f(0, 1, 0), 100));
            n.Draw.Add(Root.Instance.ResourceManager.LoadMesh("cursor01/cursor01.mesh"));
            Root.Instance.Scene.Spawn(n);
            n.Transparent = 1;
            n.rotationspeed = new Vector3(0, 90.0f / 180.0f * (float)Math.PI, 0);
            n.NoReplication = true;
            cursor = n;

            //ChatWindow = new Chat(null);
            //Root.Instance.Gui.windows.Add(ChatWindow);

            n = new Node();
            n.Draw.Add(Root.Instance.ResourceManager.LoadMesh("arrow1/arrow1.mesh"));
            Root.Instance.Scene.Spawn(n);
            n.NoReplication = true;
            Arrow = n;
        }