public Plane CreatePlane(byte faceIndex, int i_materialID, bool redrawCall) { Plane p = null; if (planes == null) { planes = new Dictionary <byte, Plane>(); } else { if (planes.ContainsKey(faceIndex)) { p = planes[faceIndex]; p.ChangeMaterial(i_materialID, redrawCall); return(p); } } var pos = myBlock.pos; if (faceIndex == Block.UP_FACE_INDEX && pos.y == Chunk.chunkSize - 1) { p = MeshMaster.GetRooftop(this, Random.value < 0.14f, !isNatural); } else { p = new Plane(this, Plane.defaultMeshType, i_materialID, faceIndex, 0); } planes.Add(faceIndex, p); if (redrawCall) { myBlock.myChunk.RefreshBlockVisualising(myBlock, faceIndex); } return(p); }
public Plane CreatePlane(byte faceIndex, bool redrawCall) { if (planes == null) { planes = new Dictionary <byte, Plane>(); } else { if (planes.ContainsKey(faceIndex)) { return(planes[faceIndex]); } } var pos = myBlock.pos; Plane p; if (faceIndex < 4) { MeshType mtype = MeshType.Quad; var f = Random.value; if (f < 0.8f) { if (f < 0.4f) { mtype = MeshType.StorageEntrance; } else { mtype = MeshType.StorageSide; } } else { mtype = MeshType.DoubleWindows; } var mp = new MultimaterialPlane(this, mtype, faceIndex, 0); mp.SetActivationStatus(isActive); p = mp; } else { if (faceIndex == Block.UP_FACE_INDEX && pos.y == Chunk.chunkSize - 1) { p = MeshMaster.GetRooftop(this, Random.value < 0.1f, true); } else { p = new Plane(this, MeshType.Quad, PoolMaster.MATERIAL_ADVANCED_COVERING_ID, faceIndex, 0); } } // planes.Add(faceIndex, p); if (redrawCall) { myBlock.myChunk.RefreshBlockVisualising(myBlock, faceIndex); } return(p); }
public Plane CreatePlane(byte faceIndex, bool redrawCall) { if (planes == null) { planes = new Dictionary <byte, Plane>(); } else { if (planes.ContainsKey(faceIndex)) { return(planes[faceIndex]); } } var pos = myBlock.pos; MeshType mtype = MeshType.Quad; int mid; bool isSideMesh = faceIndex < 4; if (isSideMesh) { mtype = MeshType.FoundationSide; mid = PoolMaster.FIXED_UV_BASIC; } else { if (faceIndex == Block.UP_FACE_INDEX && pos.y == Chunk.chunkSize - 1) { var px = MeshMaster.GetRooftop(this, Random.value < 0.1f, true); planes.Add(faceIndex, px); if (redrawCall) { myBlock.myChunk.RefreshBlockVisualising(myBlock, faceIndex); } return(px); } else { mtype = MeshType.Quad; mid = PoolMaster.MATERIAL_ADVANCED_COVERING_ID; } } // var p = new Plane(this, mtype, mid, faceIndex, 0); planes.Add(faceIndex, p); if (redrawCall) { myBlock.myChunk.RefreshBlockVisualising(myBlock, faceIndex); } return(p); }
public Plane CreatePlane(byte faceIndex, bool redrawCall) { if (planes == null) { planes = new Dictionary <byte, Plane>(); } else { if (planes.ContainsKey(faceIndex)) { return(planes[faceIndex]); } } var pos = myBlock.pos; Plane p; if (faceIndex < 4) { var mtype = (ID == FARM_BLOCK_ID ? MeshType.FarmSide : MeshType.LumbermillSide); var f = Random.value; if (f < 0.25f) { mtype = (ID == FARM_BLOCK_ID ? MeshType.FarmFace : MeshType.LumbermillFace); } else { if (f > 0.8f) { mtype = f > 0.9f ? MeshType.IndustryHeater0 : MeshType.IndustryHeater1; } else { if (f > 0.7f) { if (f > 0.75f) { mtype = MeshType.BigWindow; } else { mtype = MeshType.SmallWindows; } } } } var mp = new MultimaterialPlane(this, mtype, faceIndex, 0); mp.SetActivationStatus(isActive); p = mp; } else { if (faceIndex == Block.UP_FACE_INDEX && pos.y == Chunk.chunkSize - 1) { p = MeshMaster.GetRooftop(this, Random.value < 0.1f, true); } else { p = new Plane(this, MeshType.Quad, PoolMaster.MATERIAL_ADVANCED_COVERING_ID, faceIndex, 0); } } // planes.Add(faceIndex, p); if (redrawCall) { myBlock.myChunk.RefreshBlockVisualising(myBlock, faceIndex); } return(p); }
public Plane CreatePlane(byte faceIndex, bool redrawCall) { if (planes == null) { planes = new Dictionary <byte, Plane>(); } else { if (planes.ContainsKey(faceIndex)) { return(planes[faceIndex]); } } var pos = myBlock.pos; Plane p; if (faceIndex < 4) { var mtype = MeshType.Housing_0; float f = Random.value; if (f < 0.75f) { if (f > 0.5f) { mtype = MeshType.Housing_0; } else { if (f < 0.25f) { mtype = MeshType.Housing_1; } else { mtype = MeshType.Housing_2; } } } else { if (f > 0.92f) { mtype = MeshType.SimpleHeater_0; } else { if (f > 0.83f) { mtype = MeshType.BigWindow; } else { mtype = MeshType.SmallWindows; } } } var mp = new MultimaterialPlane(this, mtype, faceIndex, 0); mp.SetActivationStatus(isActive); p = mp; } else { if (faceIndex == Block.UP_FACE_INDEX && pos.y == Chunk.chunkSize - 1) { p = MeshMaster.GetRooftop(this, Random.value < 0.1f, true); } else { p = new Plane(this, MeshType.Quad, PoolMaster.MATERIAL_ADVANCED_COVERING_ID, faceIndex, 0); } } // planes.Add(faceIndex, p); if (redrawCall) { myBlock.myChunk.RefreshBlockVisualising(myBlock, faceIndex); } return(p); }