1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using Jypeli; |
---|
6 | using Jypeli.Assets; |
---|
7 | using MathHelper; |
---|
8 | using Entity; |
---|
9 | |
---|
10 | namespace Rooms |
---|
11 | { |
---|
12 | class EmptyRoom : Room |
---|
13 | { |
---|
14 | public EmptyRoom(TheDungeonGame game, Vector pos, Vector size, double thickness) |
---|
15 | : base(game, pos, size, thickness) |
---|
16 | { |
---|
17 | } |
---|
18 | |
---|
19 | public override void initRoom() |
---|
20 | { |
---|
21 | createLevelDecorations(); |
---|
22 | } |
---|
23 | } |
---|
24 | |
---|
25 | class RoomType1 : Room |
---|
26 | { |
---|
27 | public RoomType1(TheDungeonGame game, Vector pos, Vector size, double thickness) |
---|
28 | : base(game, pos, size, thickness) |
---|
29 | { |
---|
30 | } |
---|
31 | |
---|
32 | public override void initRoom() |
---|
33 | { |
---|
34 | createLevelDecorations(); |
---|
35 | |
---|
36 | addBlock(new ObjectRock(blockWidth, blockHeight), 0, 0); |
---|
37 | addBlock(new ObjectRock(blockWidth, blockHeight), bWidth - 1, 0); |
---|
38 | addBlock(new ObjectRock(blockWidth, blockHeight), 0, bHeight - 1, new Vector(0, -50)); |
---|
39 | addBlock(new ObjectRock(blockWidth, blockHeight), bWidth - 1, bHeight - 1, new Vector(0, -50)); |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | class RoomType2 : Room |
---|
44 | { |
---|
45 | public RoomType2(TheDungeonGame game, Vector pos, Vector size, double thickness) |
---|
46 | : base(game, pos, size, thickness) |
---|
47 | { |
---|
48 | } |
---|
49 | |
---|
50 | public override void initRoom() |
---|
51 | { |
---|
52 | createLevelDecorations(); |
---|
53 | |
---|
54 | for (int i = 0; i < 4; i++) |
---|
55 | { |
---|
56 | addBlock(new ObjectRock(blockWidth, blockHeight), 1, 1 + i, new Vector(0, -50)); |
---|
57 | } |
---|
58 | |
---|
59 | for (int i = 0; i < 4; i++) |
---|
60 | { |
---|
61 | addBlock(new ObjectRock(blockWidth, blockHeight), 8, 1 + i, new Vector(0, -50)); |
---|
62 | } |
---|
63 | } |
---|
64 | } |
---|
65 | |
---|
66 | class RoomType3 : Room |
---|
67 | { |
---|
68 | public RoomType3(TheDungeonGame game, Vector pos, Vector size, double thickness) |
---|
69 | : base(game, pos, size, thickness) |
---|
70 | { |
---|
71 | } |
---|
72 | |
---|
73 | public override void initRoom() |
---|
74 | { |
---|
75 | createLevelDecorations(); |
---|
76 | |
---|
77 | for (int i = 0; i < 4; i++) |
---|
78 | { |
---|
79 | addBlock(new ObjectRock(blockWidth, blockHeight), i, 1); |
---|
80 | } |
---|
81 | |
---|
82 | for (int i = 0; i < 4; i++) |
---|
83 | { |
---|
84 | addBlock(new ObjectRock(blockWidth, blockHeight), i, 4); |
---|
85 | } |
---|
86 | |
---|
87 | for (int i = 0; i < 4; i++) |
---|
88 | { |
---|
89 | addBlock(new ObjectRock(blockWidth, blockHeight), i + 6, 1); |
---|
90 | } |
---|
91 | |
---|
92 | for (int i = 0; i < 4; i++) |
---|
93 | { |
---|
94 | addBlock(new ObjectRock(blockWidth, blockHeight), i + 6, 4); |
---|
95 | } |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|
99 | class RoomType4 : Room |
---|
100 | { |
---|
101 | public RoomType4(TheDungeonGame game, Vector pos, Vector size, double thickness) |
---|
102 | : base(game, pos, size, thickness) |
---|
103 | { |
---|
104 | } |
---|
105 | |
---|
106 | public override void initRoom() |
---|
107 | { |
---|
108 | createLevelDecorations(); |
---|
109 | |
---|
110 | for (int y = 1; y < bHeight; y++) |
---|
111 | { |
---|
112 | for (int x = 1; x < bWidth - 1; x++) |
---|
113 | { |
---|
114 | if (x % 2 != 0 && y % 2 != 0) |
---|
115 | addBlock(new ObjectRock(blockWidth, blockHeight), x, y, new Vector(40, 0)); |
---|
116 | } |
---|
117 | } |
---|
118 | } |
---|
119 | } |
---|
120 | |
---|
121 | class RoomType5 : Room |
---|
122 | { |
---|
123 | public RoomType5(TheDungeonGame game, Vector pos, Vector size, double thickness) |
---|
124 | : base(game, pos, size, thickness) |
---|
125 | { |
---|
126 | } |
---|
127 | |
---|
128 | public override void initRoom() |
---|
129 | { |
---|
130 | createLevelDecorations(); |
---|
131 | |
---|
132 | for (int y = 0; y < 3; y++) |
---|
133 | { |
---|
134 | for (int x = 0; x < 3; x++) |
---|
135 | { |
---|
136 | addBlock(new ObjectRock(blockWidth, blockHeight), x + 3, y + 1, new Vector(30, -20)); |
---|
137 | } |
---|
138 | } |
---|
139 | |
---|
140 | deleteBlock(bWidth / 2 - 1, bHeight / 2); |
---|
141 | } |
---|
142 | } |
---|
143 | |
---|
144 | class RoomType6 : Room |
---|
145 | { |
---|
146 | public RoomType6(TheDungeonGame game, Vector pos, Vector size, double thickness) |
---|
147 | : base(game, pos, size, thickness) |
---|
148 | { |
---|
149 | } |
---|
150 | |
---|
151 | public override void initRoom() |
---|
152 | { |
---|
153 | createLevelDecorations(); |
---|
154 | |
---|
155 | for (int i = 0; i < 5; i++) |
---|
156 | { |
---|
157 | int bx = RandomGen.NextInt(bWidth); |
---|
158 | int by = RandomGen.NextInt(bHeight); |
---|
159 | addBlock(new ObjectRock(blockWidth, blockHeight), bx, by); |
---|
160 | } |
---|
161 | } |
---|
162 | } |
---|
163 | |
---|
164 | class RoomCreator |
---|
165 | { |
---|
166 | public static Room createRoom(TheDungeonGame game, Vector pos, Vector size, double thickness, int room) |
---|
167 | { |
---|
168 | Room result = null; |
---|
169 | if (room == 0) |
---|
170 | result = new EmptyRoom(game, pos, size, thickness); |
---|
171 | else if (room == 1) |
---|
172 | result = new RoomType1(game, pos, size, thickness); |
---|
173 | else if (room == 2) |
---|
174 | result = new RoomType2(game, pos, size, thickness); |
---|
175 | else if (room == 3) |
---|
176 | result = new RoomType3(game, pos, size, thickness); |
---|
177 | else if (room == 4) |
---|
178 | result = new RoomType4(game, pos, size, thickness); |
---|
179 | else if (room == 5) |
---|
180 | result = new RoomType5(game, pos, size, thickness); |
---|
181 | else if (room == 6) |
---|
182 | result = new RoomType6(game, pos, size, thickness); |
---|
183 | |
---|
184 | return result; |
---|
185 | } |
---|
186 | } |
---|
187 | } |
---|