public Powerup(Game game, Cannon cannon, int type) { Game = game; Cannon = cannon; Type = type; }
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; }
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); }
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); }