private void CreateChildNodes() { float sizeOver2 = size / 2.0f; float sizeOver4 = size / 4.0f; nodeUFR = new OcTreeNode(center + new Vector3(sizeOver4, sizeOver4, -sizeOver4), sizeOver2); nodeUFL = new OcTreeNode(center + new Vector3(-sizeOver4, sizeOver4, -sizeOver4), sizeOver2); nodeUBR = new OcTreeNode(center + new Vector3(sizeOver4, sizeOver4, sizeOver4), sizeOver2); nodeUBL = new OcTreeNode(center + new Vector3(-sizeOver4, sizeOver4, sizeOver4), sizeOver2); nodeDFR = new OcTreeNode(center + new Vector3(sizeOver4, -sizeOver4, -sizeOver4), sizeOver2); nodeDFL = new OcTreeNode(center + new Vector3(-sizeOver4, -sizeOver4, -sizeOver4), sizeOver2); nodeDBR = new OcTreeNode(center + new Vector3(sizeOver4, -sizeOver4, sizeOver4), sizeOver2); nodeDBL = new OcTreeNode(center + new Vector3(-sizeOver4, -sizeOver4, sizeOver4), sizeOver2); nodeUFR.RootSize = rootSize; nodeUFL.RootSize = rootSize; nodeUBR.RootSize = rootSize; nodeUBL.RootSize = rootSize; nodeDFR.RootSize = rootSize; nodeDFL.RootSize = rootSize; nodeDBR.RootSize = rootSize; nodeDBL.RootSize = rootSize; childList.Add(nodeUFR); childList.Add(nodeUFL); childList.Add(nodeUBR); childList.Add(nodeUBL); childList.Add(nodeDFR); childList.Add(nodeDFL); childList.Add(nodeDBR); childList.Add(nodeDBL); }
public Octree(Game game, SceneManager sceneManager, GameWorldData worldData) : base(game) { this.sceneManager = sceneManager; octreeRoot = new OcTreeNode(worldData.OCTREE_WORLD_CENTER1, worldData.OCTREE_WORLD_SIZE1); octreeRoot.RootSize = worldData.OCTREE_WORLD_SIZE1; boundryLeft = worldData.BoundryLeft; boundryRight = worldData.BoundryRight; boundryNear = worldData.BoundryNear; boundryFar = worldData.BoundryFar; enemyIDs = new List <int>(); playerIDs = new List <int>(); enemyBulletIDs = new List <int>(); playerBulletIDs = new List <int>(); tankIDs = new List <int>(); rnd = new Random(); controlTankEnabled = false; timeLastStamp = 0; }