Esempio n. 1
0
        public void Stop()
        {
            if (!Started)
            {
                return;
            }
            Started = false;
            Running = false;

            // Managers
            AIManager.StopAll();
            AIManager = null;

            // Layers
            Layer_Background.Clear();
            Layer_Other.Clear();
            Layer_Objects.Clear();
            Layer_OtherAbove.Clear();
            Layer_GUI.Clear();

            Player = null;
            HUD    = null;

            UpgradeMenu = null;

            UpdateListIndex = 0;
        }
Esempio n. 2
0
        public PowerupGUI(HeadsUpDisplay hud, int type, double time, uint graphicsMode)
        {
            HUD  = hud;
            Type = type;

            Shape       = PowerupPickup.GetModel(type, graphicsMode, 160, 180);
            Shape.Scale = new Vector2f(1.5f, 1.5f);
            AddChild(Shape);

            Time       = new Text("0.0", Game.TidyHand, 24);
            Time.Color = new Color(15, 15, 15, 220);
            FloatRect textRect = Time.GetLocalBounds();

            Time.Origin = new Vector2f(textRect.Left + (textRect.Width / 2.0f), textRect.Top + (textRect.Height / 2.0f));
            AddChild(Time);

            UpdateTimer          = new Timer(100);
            UpdateTimer.Elapsed += OnUpdate;

            Update(time);
            UpdateTimer.Start();
        }
Esempio n. 3
0
        public void Stop()
        {
            if (!Started)
                return;
            Started = false;
            Running = false;

            // Managers
            AIManager.StopAll();
            AIManager = null;

            // Layers
            Layer_Background.Clear();
            Layer_Other.Clear();
            Layer_Objects.Clear();
            Layer_OtherAbove.Clear();
            Layer_GUI.Clear();

            Player = null;
            HUD = null;

            UpgradeMenu = null;

            UpdateListIndex = 0;
        }
Esempio n. 4
0
        public void Start()
        {
            if (Started)
                return;
            Started = true;
            Running = true;

            // Background
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                RectangleShape Water = new RectangleShape(new Vector2f(Size.X, Size.Y));
                Water.FillColor = new Color(40, 118, 188);
                Layer_Background.AddChild(Water);

                WaterRipples WaterRipplesBelow = new WaterRipples(this, new Vector2f(Size.X + 40, Size.Y + 40), 120, 10, new Color(68, 131, 186));
                WaterRipplesBelow.Position = new Vector2f(-40, -40);
                Layer_Background.AddChild(WaterRipplesBelow);

                WaterRipples WaterRipples = new WaterRipples(this, new Vector2f(Size.X, Size.Y), 120, 10, new Color(80, 158, 228));
                Layer_Background.AddChild(WaterRipples);

                //VoronoiDiagram WaterEffect = new VoronoiDiagram(this, new Vector2f(Size.X, Size.Y));
                //Layer_Background.AddChild(WaterEffect);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                BluePrintBackground.Texture.Repeated = true;
                BluePrintBackground.TextureRect = new IntRect(0, 0, (int)Size.X, (int)Size.Y);
                Layer_Background.AddChild(BluePrintBackground);
            }

                // Island
            float IslandRadius = 240;

            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Sprite IslandTexture = Graphics.GetSprite("assets/sprites/island.png");
                IslandTexture.Origin = new Vector2f(IslandRadius, IslandRadius);
                IslandTexture.Position = new Vector2f((Size.X/2) + 1, (Size.Y/2));
                Layer_Background.AddChild(IslandTexture);
            }

            Island = new CircleShape(IslandRadius);
            Island.Origin = new Vector2f(IslandRadius, IslandRadius);
            Island.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Island.FillColor = new Color(0, 0, 10, 0);
                Island.OutlineThickness = 20;
                Island.OutlineColor = new Color(138, 104, 0, 100);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Island.FillColor = new Color(0, 0, 10, 30);
                Island.OutlineThickness = 2;
                Island.OutlineColor = new Color(250, 250, 250);
            }
            Island.SetPointCount(80);
            Layer_Background.AddChild(Island);

            IslandWaves = new CircleWaves(this, IslandRadius, 0.1f, 1.5f, 6, 80);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
                IslandWaves.Colour = new Color(80, 158, 228);
            IslandWaves.Position = Island.Position;
            Layer_Background.AddChild(IslandWaves);

                // Hill
            float HillRadius = 30;
            Hill = new CircleShape(HillRadius);
            Hill.Origin = new Vector2f(HillRadius, HillRadius);
            Hill.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Hill.FillColor = new Color(50, 50, 50, 150);
                Hill.OutlineThickness = 4;
                Hill.OutlineColor = new Color(0, 0, 0, 215);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Hill.FillColor = new Color(0, 0, 10, 50);
                Hill.OutlineThickness = 2;
                Hill.OutlineColor = new Color(250, 250, 250);
            }
            Hill.SetPointCount(50);
            Layer_Background.AddChild(Hill);

            // Player (Cannon)
            Player = new Cannon(this);
            Player.SetPosition(Size.X / 2, Size.Y / 2);
            Layer_OtherAbove.AddChild(Player);
            Player.SetPlayer(true);

            // AI Manager
            AIManager = new AIManager(this);
            AIManager.StartWaveCountdown();

            // HUD
            HUD = new HeadsUpDisplay(this);
            HUD.SetHealth(Player.Health);
            Layer_GUI.AddChild(HUD);
        }
Esempio n. 5
0
        public void Start()
        {
            if (Started)
            {
                return;
            }
            Started = true;
            Running = true;

            // Background
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                RectangleShape Water = new RectangleShape(new Vector2f(Size.X, Size.Y));
                Water.FillColor = new Color(40, 118, 188);
                Layer_Background.AddChild(Water);

                WaterRipples WaterRipplesBelow = new WaterRipples(this, new Vector2f(Size.X + 40, Size.Y + 40), 120, 10, new Color(68, 131, 186));
                WaterRipplesBelow.Position = new Vector2f(-40, -40);
                Layer_Background.AddChild(WaterRipplesBelow);

                WaterRipples WaterRipples = new WaterRipples(this, new Vector2f(Size.X, Size.Y), 120, 10, new Color(80, 158, 228));
                Layer_Background.AddChild(WaterRipples);

                //VoronoiDiagram WaterEffect = new VoronoiDiagram(this, new Vector2f(Size.X, Size.Y));
                //Layer_Background.AddChild(WaterEffect);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Sprite BluePrintBackground = Graphics.GetSprite("assets/sprites/background_blueprint_tile.png");
                BluePrintBackground.Texture.Repeated = true;
                BluePrintBackground.TextureRect      = new IntRect(0, 0, (int)Size.X, (int)Size.Y);
                Layer_Background.AddChild(BluePrintBackground);
            }

            // Island
            float IslandRadius = 240;

            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Sprite IslandTexture = Graphics.GetSprite("assets/sprites/island.png");
                IslandTexture.Origin   = new Vector2f(IslandRadius, IslandRadius);
                IslandTexture.Position = new Vector2f((Size.X / 2) + 1, (Size.Y / 2));
                Layer_Background.AddChild(IslandTexture);
            }

            Island          = new CircleShape(IslandRadius);
            Island.Origin   = new Vector2f(IslandRadius, IslandRadius);
            Island.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Island.FillColor        = new Color(0, 0, 10, 0);
                Island.OutlineThickness = 20;
                Island.OutlineColor     = new Color(138, 104, 0, 100);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Island.FillColor        = new Color(0, 0, 10, 30);
                Island.OutlineThickness = 2;
                Island.OutlineColor     = new Color(250, 250, 250);
            }
            Island.SetPointCount(80);
            Layer_Background.AddChild(Island);

            IslandWaves = new CircleWaves(this, IslandRadius, 0.1f, 1.5f, 6, 80);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                IslandWaves.Colour = new Color(80, 158, 228);
            }
            IslandWaves.Position = Island.Position;
            Layer_Background.AddChild(IslandWaves);

            // Hill
            float HillRadius = 30;

            Hill          = new CircleShape(HillRadius);
            Hill.Origin   = new Vector2f(HillRadius, HillRadius);
            Hill.Position = new Vector2f(Size.X / 2, Size.Y / 2);
            if (GraphicsMode == GRAPHICSMODE_NORMAL)
            {
                Hill.FillColor        = new Color(50, 50, 50, 150);
                Hill.OutlineThickness = 4;
                Hill.OutlineColor     = new Color(0, 0, 0, 215);
            }
            else if (GraphicsMode == GRAPHICSMODE_BLUEPRINT)
            {
                Hill.FillColor        = new Color(0, 0, 10, 50);
                Hill.OutlineThickness = 2;
                Hill.OutlineColor     = new Color(250, 250, 250);
            }
            Hill.SetPointCount(50);
            Layer_Background.AddChild(Hill);

            // Player (Cannon)
            Player = new Cannon(this);
            Player.SetPosition(Size.X / 2, Size.Y / 2);
            Layer_OtherAbove.AddChild(Player);
            Player.SetPlayer(true);

            // AI Manager
            AIManager = new AIManager(this);
            AIManager.StartWaveCountdown();

            // HUD
            HUD = new HeadsUpDisplay(this);
            HUD.SetHealth(Player.Health);
            Layer_GUI.AddChild(HUD);
        }
Esempio n. 6
0
        public PowerupGUI(HeadsUpDisplay hud, int type, double time, uint graphicsMode)
        {
            HUD = hud;
            Type = type;

            Shape = PowerupPickup.GetModel(type, graphicsMode, 160, 180);
            Shape.Scale = new Vector2f(1.5f, 1.5f);
            AddChild(Shape);

            Time = new Text("0.0", Game.TidyHand, 24);
            Time.Color = new Color(15, 15, 15, 220);
            FloatRect textRect = Time.GetLocalBounds();
            Time.Origin = new Vector2f(textRect.Left + (textRect.Width / 2.0f), textRect.Top + (textRect.Height / 2.0f));
            AddChild(Time);

            UpdateTimer = new Timer(100);
            UpdateTimer.Elapsed += OnUpdate;

            Update(time);
            UpdateTimer.Start();
        }