/// <summary> /// collector are thing for collecting info about colliders /// if you want to modify information or add maps there is best place to start /// </summary> private void PopulateCollectors() { if (profiler != null) { profiler.AddLog("collecting colliders"); } HashSet <Collider> collidersHS = new HashSet <Collider>(); //unity return ONE collider for terrain in editor but when playmode active it return lots! for evefy f*****g tree! who invent this? why?! foreach (var collider in Physics.OverlapBox(chunkOffsetedBounds.center, chunkOffsetedBounds.extents, Quaternion.identity, properties.includedLayers, QueryTriggerInteraction.Ignore)) { collidersHS.Add(collider);//for this reason everything are puttet into hashset to exclude dublicates } Collider[] colliders = collidersHS.ToArray(); colliderCollector = new ColliderCollector(this); colliderCollector.profiler = profiler; colliderCollector.AddCollider(colliders); List <AreaWorldMod> mods = new List <AreaWorldMod>(); ChunkContentMap.GetContent(chunkData.x, chunkData.z, mods); //this uses some grid based thing. you give it list to fill and where colliderCollector.AddModifyers(mods); hashData.AssignData(); }
public void OnEnable() { Init(); RebuildChilds(false); DirtyAll(); CheckDirty(); ChunkContentMap.Process(this); }
public bool CheckDirty() { bool any = false; for (int i = 0; i < allMods.Count; i++) { if (allMods[i].CheckDirty()) { any = true; } } if (any) { RecalculateBounds(); ChunkContentMap.Process(this); } return(any); }
public void OnDestroy() { ChunkContentMap.RemoveContent(this); }
public void OnDisable() { ChunkContentMap.RemoveContent(this); }