Description:
Add spawner.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r193:021240ad8a7a -

@@ -0,0 +1,10
1
2 using Encompass;
3
4 namespace isometricparkfna.Components
5 {
6 public struct NameComponent : IComponent
7 {
8 public string DisplayName;
9 }
10 } No newline at end of file
@@ -0,0 +1,22
1
2 using Encompass;
3
4 using isometricparkfna.Messages;
5 using isometricparkfna.Components;
6
7 namespace isometricparkfna.Spawners {
8
9 [Receives(typeof(SpawnContractMessage))]
10 class ContractSpawner : Spawner<SpawnContractMessage>
11 {
12
13 protected override void Spawn(in SpawnContractMessage message)
14 {
15 var contract = CreateEntity();
16 // AddComponent
17 AddComponent(contract, new AreaComponent{squares = message.squares});
18 AddComponent(contract, new NameComponent{DisplayName = message.name});
19
20 }
21 }
22 } No newline at end of file
@@ -0,0 +1,11
1
2 using Microsoft.Xna.Framework;
3 using Encompass;
4
5 namespace isometricparkfna.Messages {
6 public struct SpawnContractMessage : IMessage
7 {
8 public Vector2[] squares;
9 public string name;
10 }
11 } No newline at end of file
@@ -20,6 +20,8
20 using isometricparkfna.Engines;
20 using isometricparkfna.Engines;
21 using isometricparkfna.Components;
21 using isometricparkfna.Components;
22 using isometricparkfna.Renderers;
22 using isometricparkfna.Renderers;
23 using isometricparkfna.Messages;
24 using isometricparkfna.Spawners;
23
25
24 using ImGuiNET.SampleProgram.XNA;
26 using ImGuiNET.SampleProgram.XNA;
25 using ImGuiNET;
27 using ImGuiNET;
@@ -196,13 +198,16
196 WorldBuilder.AddEngine(new CameraBridgeEngine(this.camera));
198 WorldBuilder.AddEngine(new CameraBridgeEngine(this.camera));
197 this.imGuiWindowBridgeEngine = new ImGuiWindowBridgeEngine();
199 this.imGuiWindowBridgeEngine = new ImGuiWindowBridgeEngine();
198 WorldBuilder.AddEngine(this.imGuiWindowBridgeEngine);
200 WorldBuilder.AddEngine(this.imGuiWindowBridgeEngine);
201 WorldBuilder.AddEngine(new ContractSpawner());
199
202
200 // var budgetWindow = WorldBuilder.CreateEntity();
203 // var budgetWindow = WorldBuilder.CreateEntity();
201 // WorldBuilder.SetComponent(budgetWindow, new VisibilityComponent{visible = true});
204 // WorldBuilder.SetComponent(budgetWindow, new VisibilityComponent{visible = true});
202 // WorldBuilder.SetComponent(budgetWindow, new BudgetComponent());
205 // WorldBuilder.SetComponent(budgetWindow, new BudgetComponent());
203
206
204 var area = WorldBuilder.CreateEntity();
207 var area = WorldBuilder.CreateEntity();
205 WorldBuilder.SetComponent(area, new AreaComponent{squares = new[] {new Vector2(4,4), new Vector2(5,4)}});
208 // WorldBuilder.SetComponent(area, new AreaComponent{squares = new[] {new Vector2(4,4), new Vector2(5,4)}});
209 WorldBuilder.SendMessage(new SpawnContractMessage{squares = new[] {new Vector2(4,4), new Vector2(5,4)},
210 name = "Contract"});
206
211
207 World = WorldBuilder.Build();
212 World = WorldBuilder.Build();
208
213
@@ -46,6 +46,7
46 <Compile Include="Engines\*.cs" />
46 <Compile Include="Engines\*.cs" />
47 <Compile Include="Messages\*.cs" />
47 <Compile Include="Messages\*.cs" />
48 <Compile Include="Renderers\*.cs" />
48 <Compile Include="Renderers\*.cs" />
49 <Compile Include="Engines\Spawners\*.cs" />
49 <Compile Include="Utils\MathUtils.cs" />
50 <Compile Include="Utils\MathUtils.cs" />
50 <Compile Include="Utils\Extensions.cs" />
51 <Compile Include="Utils\Extensions.cs" />
51 <Compile Include="Utils\Extensions.cs" />
52 <Compile Include="Utils\Extensions.cs" />
You need to be logged in to leave comments. Login now