2 using System.Collections.Generic;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Graphics;
7 using Microsoft.Xna.Framework.Content;
9 namespace SuperPolarity
11 static class ActorFactory
13 static internal SuperPolarity Game;
15 static public MainShip CreateMainShip(Vector2 position)
17 MainShip mainShip = new MainShip(Game);
18 mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position);
20 ActorManager.CheckIn(mainShip);
25 static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position)
27 StandardShip ship = new StandardShip(Game);
30 if (polarity == Ship.Polarity.Positive)
32 texture = Game.Content.Load<Texture2D>("Graphics\\positive-ship");
34 else if (polarity == Ship.Polarity.Negative)
36 texture = Game.Content.Load<Texture2D>("Graphics\\negative-ship");
40 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-ship");
43 ship.Initialize(texture, position);
44 ship.SetPolarity(polarity);
46 ActorManager.CheckIn(ship);
51 internal static void SetGame(SuperPolarity game)
53 ActorFactory.Game = game;
56 internal static Bullet CreateBullet(Vector2 position, float angle)
58 Bullet bullet = new Bullet(Game);
60 bullet.Initialize(Game.Content.Load<Texture2D>("Graphics\\square"), position);
64 ActorManager.CheckIn(bullet);
69 static public StandardShip CreateScout(Ship.Polarity polarity, Vector2 position)
71 StandardShip ship = new StandardShip(Game);
74 if (polarity == Ship.Polarity.Positive)
76 texture = Game.Content.Load<Texture2D>("Graphics\\positive-scout");
78 else if (polarity == Ship.Polarity.Negative)
80 texture = Game.Content.Load<Texture2D>("Graphics\\negative-scout");
84 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-scout");
87 ship.BoxDimensions.X = 10;
88 ship.BoxDimensions.Y = 10;
89 ship.BoxDimensions.W = 10;
90 ship.BoxDimensions.Z = 10;
92 ship.Initialize(texture, position);
93 ship.MaxVelocity = 5.2f;
94 ship.FleeVelocity = 6.5f;
95 ship.ChargeVelocity = 5.5f;
98 ship.AngleChangeProbability = 20;
99 ship.SetPolarity(polarity);
101 ActorManager.CheckIn(ship);
106 static public StandardShip CreateCruiser(Ship.Polarity polarity, Vector2 position)
108 StandardShip ship = new StandardShip(Game);
111 if (polarity == Ship.Polarity.Positive)
113 texture = Game.Content.Load<Texture2D>("Graphics\\positive-cruiser");
115 else if (polarity == Ship.Polarity.Negative)
117 texture = Game.Content.Load<Texture2D>("Graphics\\negative-cruiser");
121 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-cruiser");
124 ship.BoxDimensions.X = 40;
125 ship.BoxDimensions.Y = 40;
126 ship.BoxDimensions.W = 40;
127 ship.BoxDimensions.Z = 40;
129 ship.Initialize(texture, position);
130 ship.MagneticRadius = 1000;
131 ship.RepelRadius = 200;
132 ship.MaxVelocity = 0.5f;
133 ship.FleeVelocity = 5;
134 ship.ChargeVelocity = 1;
137 ship.SetPolarity(polarity);
139 ActorManager.CheckIn(ship);