]> git.r.bdr.sh - rbdr/super-polarity/blame - SuperPolarity/ActorFactory.cs
Update README
[rbdr/super-polarity] / SuperPolarity / ActorFactory.cs
CommitLineData
9ad526c0 1using System;
f8aec187
BB
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Xna.Framework;
6using Microsoft.Xna.Framework.Graphics;
7using Microsoft.Xna.Framework.Content;
8
9namespace SuperPolarity
10{
11 static class ActorFactory
12 {
74c15570 13 static internal SuperPolarity Game;
f8aec187
BB
14
15 static public MainShip CreateMainShip(Vector2 position)
16 {
2af83e98
BB
17 MainShip mainShip = new MainShip(Game);
18 mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position);
f8aec187
BB
19
20 ActorManager.CheckIn(mainShip);
21
22 return mainShip;
23 }
24
2af83e98 25 static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position)
f8aec187 26 {
2af83e98
BB
27 StandardShip ship = new StandardShip(Game);
28 Texture2D texture;
29
30 if (polarity == Ship.Polarity.Positive)
31 {
32 texture = Game.Content.Load<Texture2D>("Graphics\\positive-ship");
33 }
34 else if (polarity == Ship.Polarity.Negative)
35 {
36 texture = Game.Content.Load<Texture2D>("Graphics\\negative-ship");
37 }
38 else
39 {
40 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-ship");
41 }
42
43 ship.Initialize(texture, position);
44 ship.SetPolarity(polarity);
45
46 ActorManager.CheckIn(ship);
47
48 return ship;
49 }
50
74c15570 51 internal static void SetGame(SuperPolarity game)
2af83e98
BB
52 {
53 ActorFactory.Game = game;
f8aec187 54 }
38c7d3f9
BB
55
56 internal static Bullet CreateBullet(Vector2 position, float angle)
57 {
58 Bullet bullet = new Bullet(Game);
59
60 bullet.Initialize(Game.Content.Load<Texture2D>("Graphics\\square"), position);
61
62 bullet.Angle = angle;
63
64 ActorManager.CheckIn(bullet);
65
66 return bullet;
67 }
097781e6
BB
68
69 static public StandardShip CreateScout(Ship.Polarity polarity, Vector2 position)
70 {
71 StandardShip ship = new StandardShip(Game);
72 Texture2D texture;
73
74 if (polarity == Ship.Polarity.Positive)
75 {
76 texture = Game.Content.Load<Texture2D>("Graphics\\positive-scout");
77 }
78 else if (polarity == Ship.Polarity.Negative)
79 {
80 texture = Game.Content.Load<Texture2D>("Graphics\\negative-scout");
81 }
82 else
83 {
84 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-scout");
85 }
86
87 ship.BoxDimensions.X = 10;
88 ship.BoxDimensions.Y = 10;
89 ship.BoxDimensions.W = 10;
90 ship.BoxDimensions.Z = 10;
91
92 ship.Initialize(texture, position);
b587e9d8 93 ship.MaxVelocity = 5.2f;
097781e6
BB
94 ship.FleeVelocity = 6.5f;
95 ship.ChargeVelocity = 5.5f;
96 ship.Value = 3;
97 ship.HP = 0;
98 ship.AngleChangeProbability = 20;
99 ship.SetPolarity(polarity);
100
101 ActorManager.CheckIn(ship);
097781e6
BB
102
103 return ship;
104 }
105
106 static public StandardShip CreateCruiser(Ship.Polarity polarity, Vector2 position)
107 {
108 StandardShip ship = new StandardShip(Game);
109 Texture2D texture;
110
111 if (polarity == Ship.Polarity.Positive)
112 {
113 texture = Game.Content.Load<Texture2D>("Graphics\\positive-cruiser");
114 }
115 else if (polarity == Ship.Polarity.Negative)
116 {
117 texture = Game.Content.Load<Texture2D>("Graphics\\negative-cruiser");
118 }
119 else
120 {
121 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-cruiser");
122 }
123
124 ship.BoxDimensions.X = 40;
125 ship.BoxDimensions.Y = 40;
126 ship.BoxDimensions.W = 40;
127 ship.BoxDimensions.Z = 40;
128
129 ship.Initialize(texture, position);
b587e9d8
BB
130 ship.MagneticRadius = 1000;
131 ship.RepelRadius = 200;
097781e6
BB
132 ship.MaxVelocity = 0.5f;
133 ship.FleeVelocity = 5;
134 ship.ChargeVelocity = 1;
9ad526c0
BB
135 ship.Value = 7;
136 ship.HP = 39;
097781e6
BB
137 ship.SetPolarity(polarity);
138
139 ActorManager.CheckIn(ship);
097781e6
BB
140
141 return ship;
142 }
f8aec187
BB
143 }
144}