public void AddTiles(float worldX, float worldZ, int width, int depth, bool forWall) { if (this.generated) { Service.Logger.Error("Cannot add tiles after mesh has been generated"); return; } if (this.mesh == null) { this.mesh = new FootprintMesh(this.MakeName("Tiles")); } float num = (float)width * this.tileSize; float num2 = (float)depth * this.tileSize; float num3 = this.tileSize * 0.5f; if (forWall) { if (this.secondaryMesh == null) { this.secondaryMesh = new FootprintMesh(this.MakeName("Secondary Tiles")); } this.secondaryMesh.AddQuad(worldX, worldZ, num, num2); this.mesh.AddQuad(worldX - num3, worldZ - num3, num * 2f, num2 * 2f); } else { if (width != 1 || depth != 1) { worldX -= num3; worldZ -= num3; } this.mesh.AddQuad(worldX, worldZ, num, num2); } }
public void DestroyFootprint() { if (this.mesh != null) { this.mesh.DestroyFootprintMesh(); this.mesh = null; } if (this.secondaryMesh != null) { this.secondaryMesh.DestroyFootprintMesh(); this.secondaryMesh = null; } if (this.validInnerMaterial != null) { UnityUtils.DestroyMaterial(this.validInnerMaterial); this.validInnerMaterial = null; } if (this.validOuterMaterial != null) { UnityUtils.DestroyMaterial(this.validOuterMaterial); this.validOuterMaterial = null; } if (this.invalidMaterial != null) { UnityUtils.DestroyMaterial(this.invalidMaterial); this.invalidMaterial = null; } }