Ejemplo n.º 1
0
        public Player(Texture2D cursor, Point size, Texture2D[] statusBar, ContentManager cm)
            : base()
        {
#if DEBUG
            buildingID = "Nan";
#endif
            sub_m       = Sub_Player_Modes.Display_FHB;
            persistance = (float)(Statistics.TotalEnergyGained / 1000000);
            persistance = persistance * 0.03f;
            mode        = Player_Modes.MainMenu;
            controls    = new ControlMapper("Content/settings/controls.txt");
            this.cursor = new Cursor(cm.Load <Texture2D>("texture/cursor_sheet"), new Dictionary <string, Vector3>()
            {
                { "M_Build", new Vector3(0, 1, 500) },
                { "M_Research", new Vector3(2, 7, 100) },
                { "M_Spells", new Vector3(8, 13, 200) },
                { "M_Tools", new Vector3(14, 17, 150) },
                { "M_Pause", new Vector3(18, 26, 300) }
            });
            this.energy = 2000;
            max_energy  = this.energy;
            status_bar  = new StatusBar(size, energy, statusBar, new Text(Vector2.One, "", Color.White));
            status_bar.UpdatePosition(new Vector2(10, 850));
            text = new Text(status_bar.Position + status_bar.GetText.Position + new Vector2(128, -22), "", Color.White);
            status_bar.GetText.Colour = Color.DarkSlateGray;
            populationDisplay         = new KeyValuePair <Text, Text>(new Text(Vector2.Zero, "Zombies: ", Color.DarkKhaki), new Text(Vector2.Zero, "", Color.White));
            pop_changed = false;
        }
Ejemplo n.º 2
0
        public void Update(UiMaster master, MouseState ms, Architech arch, GameTime gt)
        {
            cursor.Update(ms, gt);
            status_bar.Update(energy);
            UpdatePopulation();
            pop_changed = false;
            pop_cap     = arch.GetCountByType(BuildingTypes.Grave) * 5;

            if (!arch.IsHomeAlive)
            {
                mode = Player_Modes.End_Screen;
            }

            if ((mode == Player_Modes.End_Screen || Statistics.Ending != Endings.Passive) && !finished)
            {
                finished = true;
                switch (Statistics.Ending)
                {
                case Endings.Death:
                    master.ManipulateElements(new Text(Vector2.Zero, "You have destroyed all those who opposed you, death stalks the land at your bidding.", Color.Khaki), Player_Modes.End_Screen, "", 0);
                    master.ManipulateElements(new Text(Vector2.Zero, Statistics.Output, Color.AntiqueWhite), Player_Modes.End_Screen, "", 0);
                    mode = Player_Modes.End_Screen;
                    break;

                case Endings.God:
                    master.ManipulateElements(new Text(Vector2.Zero, "Humanity kneel at your feet, you are their new prophet. Peace finally.", Color.PaleVioletRed), Player_Modes.End_Screen, "", 0);
                    master.ManipulateElements(new Text(Vector2.Zero, Statistics.Output, Color.AntiqueWhite), Player_Modes.End_Screen, "", 0);
                    mode = Player_Modes.End_Screen;
                    break;

                case Endings.Passive:
                    master.ManipulateElements(new Text(Vector2.Zero, "Either through your own fruition or your enemies, you have been defeated.", Color.PaleVioletRed), Player_Modes.End_Screen, "", 0);
                    master.ManipulateElements(new Text(Vector2.Zero, Statistics.Output, Color.AntiqueWhite), Player_Modes.End_Screen, "", 0);
                    mode = Player_Modes.End_Screen;
                    break;
                }
            }

            if (controls.IsPressed(Ctrls.HotKey_Build))
            {
                mode = Player_Modes.Building;
            }
            if (controls.IsPressed(Ctrls.HotKey_Research))
            {
                mode = Player_Modes.Research;
            }
            if (controls.IsPressed(Ctrls.HotKey_Spells))
            {
                mode = Player_Modes.Spells;
            }
            if (controls.IsPressed(Ctrls.HotKey_Pause))
            {
                mode = Player_Modes.Pause;
            }
            switch (master.NextAction)
            {
            case ButtonFunction.M_Build:
                master.Pop_Action();
                mode = Player_Modes.Building;
                break;

            case ButtonFunction.M_Research:
                master.Pop_Action();
                mode = Player_Modes.Research;
                break;

            case ButtonFunction.M_Spells:
                master.Pop_Action();
                mode = Player_Modes.Spells;
                break;

            case ButtonFunction.M_Tools:
                master.Pop_Action();
                mode = Player_Modes.Tools;
                break;

            case ButtonFunction.M_Pause:
                master.Pop_Action();
                mode = Player_Modes.Pause;
                break;

            case ButtonFunction.MM_Start:
                master.Pop_Action();
                mode = Player_Modes.Tutorial;
                break;

            case ButtonFunction.MM_Hiscores:
                master.Pop_Action();
                break;

            case ButtonFunction.Guide:
                master.Pop_Action();
                mode = Player_Modes.Tutorial;
                break;

            case ButtonFunction.ES_End:
                master.Pop_Action();
                mode = Player_Modes.Surrender;
                break;

            case ButtonFunction.ReallySurrender:
                master.Pop_Action();
                mode = Player_Modes.End_Screen;
                break;

            case ButtonFunction.Settings:
                master.Pop_Action();
                mode = Player_Modes.Settings;
                break;

            case ButtonFunction.Tog_EHB:
                master.Pop_Action();
                if (sub_m.HasFlag(Sub_Player_Modes.Display_EHB))
                {
                    sub_m &= ~Sub_Player_Modes.Display_EHB;
                }
                else
                {
                    sub_m |= Sub_Player_Modes.Display_EHB;
                }
                break;

            case ButtonFunction.Tog_FHB:
                master.Pop_Action();
                if (sub_m.HasFlag(Sub_Player_Modes.Display_FHB))
                {
                    sub_m &= ~Sub_Player_Modes.Display_FHB;
                }
                else
                {
                    sub_m |= Sub_Player_Modes.Display_FHB;
                }
                break;
            }

            switch (this.mode)
            {
            case Player_Modes.Building:
                this.cursor.CurrentState = ButtonFunction.M_Build.ToString();
                break;

            case Player_Modes.Pause:
                this.cursor.CurrentState = ButtonFunction.M_Pause.ToString();
                break;

            case Player_Modes.Research:
                this.cursor.CurrentState = ButtonFunction.M_Research.ToString();
                break;

            case Player_Modes.Tools:
                this.cursor.CurrentState = ButtonFunction.M_Tools.ToString();
                break;

            case Player_Modes.Spells:
            case Player_Modes.MainMenu:
                this.cursor.CurrentState = ButtonFunction.M_Spells.ToString();
                break;
            }
        }