public int GetRank() { if (wallRank == 0) { wallRank = GlobalRegistry.GetWallRank(); } return(wallRank); }
void Start() { myRenderer.sortingOrder = (int)((transform.position.y - myRenderer.bounds.extents.y) * GlobalRegistry.SORTING_Y_MULTIPLIER()); //Populate Polygon Mesh //Call GlobalRegistry for rank of this wall //It's possible rank 1 has already called getEntries on this wall, so make sure walLRank hasn't been set yet if (wallRank == 0) { wallRank = GlobalRegistry.GetWallRank(); } if (wallRank == 1) { rankOne = this; } }
//public void GetEntries(ref Dictionary<Vector2, Vector2> pointDict) { public void GetEntries(ref List <Vector3> pointList) { if (wallRank == 0) { wallRank = GlobalRegistry.GetWallRank(); } float bottom = myRenderer.bounds.min.y; float top = myRenderer.bounds.max.y; float left = myRenderer.bounds.min.x; float right = myRenderer.bounds.max.x; /*pointDict.Add(new Vector2(left, top), new Vector2(right, top)); * pointDict.Add(new Vector2(right, top), new Vector2(right, bottom)); * pointDict.Add(new Vector2(right, bottom), new Vector2(left, bottom)); * pointDict.Add(new Vector2(left, bottom), new Vector2(left, top));*/ //Wall Rank is entered as z so the algorithm will know which wall this point is from pointList.Add(new Vector3(left, top, wallRank)); pointList.Add(new Vector3(right, top, wallRank)); pointList.Add(new Vector3(right, bottom, wallRank)); pointList.Add(new Vector3(left, bottom, wallRank)); }