2 using System.Collections.Generic;
5 using Microsoft.Xna.Framework;
7 namespace SuperPolarity
11 public enum Ships : byte { Ship, Scout, Battlecruiser };
13 protected Ships ShipType;
14 protected SuperPolarity Game;
15 protected int ScoreThreshold;
17 protected int CurrentTime;
18 protected Random Randomizer;
19 protected Vector2 Position;
21 public void Initialize(SuperPolarity game, Vector2 position, Ships shipType, int rate, int scoreThreshold)
25 ScoreThreshold = scoreThreshold;
27 Randomizer = new Random();
32 public void Update(GameTime gameTime)
34 if (ActorManager.CountBaddies() > 50)
39 if (Game.Player.Score >= ScoreThreshold)
41 CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds;
43 if (CurrentTime >= Rate)
51 protected void Spawn()
53 var polarity = Ship.Polarity.Positive;
55 if (Randomizer.Next(2) == 1)
57 polarity = Ship.Polarity.Negative;
60 if (ShipType == Ships.Ship)
62 Renderer.CheckIn(ActorFactory.CreateShip(polarity, Position));
65 if (ShipType == Ships.Scout)
67 Renderer.CheckIn(ActorFactory.CreateScout(polarity, Position));
70 if (ShipType == Ships.Battlecruiser)
72 Renderer.CheckIn(ActorFactory.CreateCruiser(polarity, Position));