root/src/BRAINSFramework/World.cs
| 24 | 25 | ||
|---|---|---|---|
11 | using Brains.Framework.Utility; | 11 | using Brains.Framework.Utility; |
12 | using Brains.Framework.Behaviors.PathFinding; | 12 | using Brains.Framework.Behaviors.PathFinding; |
13 | using Brains.Framework.Grouping; | 13 | using Brains.Framework.Grouping; |
14 | using Brains.Spatial; | ||
14 | 15 | ||
15 | namespace Brains.Framework | 16 | namespace Brains.Framework |
16 | { | 17 | { |
... | ... | ||
26 | private List<Agent> _agentsToRemove = new List<Agent>(); | 27 | private List<Agent> _agentsToRemove = new List<Agent>(); |
27 | private Texture2D _mapTexture; | 28 | private Texture2D _mapTexture; |
28 | private WorldMap _map; | 29 | private WorldMap _map; |
29 | 30 | internal SpatialTable _spatialtable; | |
30 | // | 31 | // |
31 | //Public properties | 32 | //Public properties |
32 | // | 33 | // |
... | ... | ||
50 | public World() | 51 | public World() |
51 | { | 52 | { |
52 | Groups = new Dictionary<int, Group>(); | 53 | Groups = new Dictionary<int, Group>(); |
54 | |||
53 | } | 55 | } |
54 | // | 56 | // |
55 | //Public Methods | 57 | //Public Methods |
... | ... | ||
112 | int clusterRows = totalCols / maxclusterwidth; | 114 | int clusterRows = totalCols / maxclusterwidth; |
113 | int clusterCols = totalRows/ maxclusterheight; | 115 | int clusterCols = totalRows/ maxclusterheight; |
114 | _map.ClusterGrid.Setup(clusterRows, clusterCols); | 116 | _map.ClusterGrid.Setup(clusterRows, clusterCols); |
117 | _spatialtable = new SpatialTable(); | ||
118 | _spatialtable.Setup(width, height, cellsize); | ||
119 | |||
115 | Vector2 position = new Vector2(); | 120 | Vector2 position = new Vector2(); |
116 | for (int y = 0; y < clusterRows; y++) | 121 | for (int y = 0; y < clusterRows; y++) |
117 | { | 122 | { |
... | ... | ||
681 | { | 686 | { |
682 | actor.ParentWorld = this; | 687 | actor.ParentWorld = this; |
683 | Actors.Add(actor); | 688 | Actors.Add(actor); |
689 | _spatialtable.RegisterObject(actor); | ||
684 | } | 690 | } |
685 | /// <summary> | 691 | /// <summary> |
686 | /// Loads Map data from a texture | 692 | /// Loads Map data from a texture |
Download diff