Esempio n. 1
0
        void UpdateInfo(ActorInfoWindow info, Actor actor)
        {
            if (info == null)
                return;

            if (actor != null && !actor.Kill)
            {
                info.Visible = true;
                Actor t = actor;

                float[] f = Root.Instance.UserInterface.Renderer.GetRasterPosition(Vector3Extensions.ToFloats(t.SmoothPosition));
                Vector2 v = new Vector2(f[0],f[1]);
                v.Y = Root.Instance.UserInterface.Renderer.Size.Y - v.Y;
                info.Position = new Vector2((int)(v.X + 0.5f), (int)(v.Y + 0.5f));

                if (t.Shield != null)
                    info.ShieldBar.Value = t.Shield.CurrentCharge / t.Shield.MaxEnergy;
                else
                    info.ShieldBar.Value = 0;
                if (t.Hull != null)
                    info.HitpointBar.Value = t.Hull.CurrentHitpoints / t.Hull.MaxHitpoints;
                else
                    info.HitpointBar.Value = 0;

                if (t.Battery != null)
                    info.EneryBar.Value = t.Battery.CurrentCharge;
                else
                    info.EneryBar.Value = 0;

                /*
                if (t is SpaceShip)
                {
                    SpaceShip s = (SpaceShip)t;
                    info.EneryBar.Value = s.Battery.CurrentCharge;
                }
                else
                    info.EneryBar.Value = 0;
                */

                if (actor.Owner != null)
                {
                    info.Name.Caption = actor.Owner.Name;
                    if (actor.Owner is Player && ((Player)actor.Owner).Team >= 0)
                        info.Name.TextColor = Team.Colors[((Player)actor.Owner).Team];
                    else
                        info.Name.TextColor = new Color4f(1, 1, 1, 1);
                }
                else
                {
                    info.Name.TextColor = new Color4f(1, 1, 1, 1);
                    info.Name.Caption = actor.Name;
                }

            }
            else
                info.Visible = false;
        }
Esempio n. 2
0
        //Label Message;
        protected void Init()
        {
            Node n;

            Player = Rule.CreatePlayer(Root.Instance.Scene.ClientNumber, Root.Instance.ResourceManager.LoadConfig("config/global.config").GetString("player.name"));
            Player.Team = 0;
            Player.HearEvent += HearPlayer;
            Root.Instance.Scene.Spawn(Player);

            ShipType = typeof(Dreadnaught);

            if (!Spectate)
            {
                SpawnShip();

                PlayerInfo = new ActorInfoWindow();
                Root.Instance.Gui.windows.Add(PlayerInfo);
                TargetInfo = new ActorInfoWindow();
                Root.Instance.Gui.windows.Add(TargetInfo);

            }
            else
            {
                MainCamera.Position = new Vector3(10000, 10000, 10000);
                MainCamera.LookAt(0, 0, 0);
            }

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

            Root.Instance.Scene.Background = Root.Instance.ResourceManager.LoadMesh("skycubemap/skycubemap.mesh");
        }