Exemplo n.º 1
0
        void SpawnShip()
        {
            TimeToSpawn = SpawnTime;
            //playership = new TestShip();
            playership = (SpaceShip)Activator.CreateInstance(ShipType);
            PlayerStart ps = GetSpawnLocation();
            if (ps != null)
            {
                playership.Position = ps.AbsolutePosition;
                playership.Orientation = ps.Orientation;
            }

            playership.Owner = Player;
            Root.Instance.Scene.Spawn(playership);
            Control = new SpaceShipControl(playership, cursor);

            MainCamera.Target = playership;
            //FlyByCamera.Attach = playership;

               // if (ControlMenu != null)
            //{
                //Rule.AnnounceEvent -= ControlMenu.Comm.WriteLine;
                Rule.AnnounceEvent -= Log.WriteLine;
                //ControlMenu.Close();
            //}
            //Root.Instance.Gui.windows.Add(ControlMenu = new ControlDisplay(300, playership));
            //playership.Computer.TextMonitor = ControlMenu.Comm;
            //Rule.AnnounceEvent += ControlMenu.Comm.WriteLine;
            Rule.AnnounceEvent += Log.WriteLine;

            if (Display != null)
            {
                Display.Close();
            }

            if (Root.Instance.Gui != null)
            {
                Root.Instance.Gui.windows.Add(Display = new WeaponDisplay(playership.Slots));
                if (Bar != null)
                {
                    Bar.Close();
                }
                Root.Instance.Gui.windows.Add(Bar = new WeaponBar(playership, Display));

                if (Radar != null)
                {
                    Radar.Close();
                }
                Root.Instance.Gui.windows.Add(Radar = new RadarDisplay());
            }
            //ControlMenu.Ship = playership;
            //ControlMenu.Visible=false;
        }
Exemplo n.º 2
0
        public ControlDisplay(float w,SpaceShip s)
            : base(0, 0, Root.Instance.UserInterface.Renderer.Size.X, Root.Instance.UserInterface.Renderer.Size.Y, new Layout(2, 4))
        {
            Transparent = true;

            Layout.Widths[0] = Root.Instance.UserInterface.Renderer.Size.X-250;
            Layout.Widths[1] = 250;

            Layout.GetCell(0, 0).Span.Y = 4;

            Layout.Heights[0] = 0.5f;
            WeaponDisplay = new WeaponDisplay(s.Slots);
            Add(WeaponDisplay, 1, 0);

            WeaponManager = new WeaponManager(s);
            Add(WeaponManager, 1, 1);

            Comm = new Chat(s.GetPlayer());
            Add(Comm, 1, 2);

            RadarDisplay rd = new RadarDisplay();
            Add(rd, 1, 3);

            //InfoWindow = new GameInfoDisplay();
            //InfoWindow.Visible = false;
            //Add(InfoWindow,0,0);

            Layout.Update(Size);
        }