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();
31 public void Update(GameTime gameTime)
33 if (Game.Player.Score > ScoreThreshold)
35 CurrentTime = CurrentTime + gameTime.ElapsedGameTime.Milliseconds;
37 if (CurrentTime >= Rate)
45 protected void Spawn()
47 var polarity = Ship.Polarity.Positive;
49 if (Randomizer.Next(2) == 1)
51 polarity = Ship.Polarity.Negative;
54 if (ShipType == Ships.Ship)
56 ActorFactory.CreateShip(polarity, Position);
59 if (ShipType == Ships.Scout)
61 ActorFactory.CreateScout(polarity, Position);
64 if (ShipType == Ships.Battlecruiser)
66 ActorFactory.CreateCruiser(polarity, Position);