void Start() { if (grid == null) { Debug.LogError("Missing SharedGrid instance!"); } addMap = new float[grid.GetWidth(), grid.GetHeight()]; decayMap = new float[grid.GetWidth(), grid.GetHeight()]; updateTime = 1 / updateFrequency; tex = new Texture2D(grid.GetWidth(), grid.GetHeight()); if (standalone) { GetComponent <Renderer>().material.mainTexture = tex; } tex.filterMode = FilterMode.Point; if (standalone) { StartCoroutine("ParallelUpdateMap"); // ACTUALLY BETTER TO RUN IN PARALLEL! } }
void Start() { if (grid == null) { Debug.LogError("Missing SharedGrid instance!"); } heightObstacleMap = new float[grid.GetWidth(), grid.GetHeight()]; foreach (Transform child in transform) { foreach (var gridPos in grid.ProjectGridPos(child.GetComponent <Renderer>().bounds)) { heightObstacleMap[gridPos.x, gridPos.y] = child.GetComponent <Renderer>().bounds.size.y; } } }