public bool Generate(uint landblockID, int cellScale, LandDefs.Direction transAdj) { var cellWidth = LandDefs.BlockSide / cellScale; if (cellWidth == SideCellCount && TransDir == transAdj) { return(false); } var cellRegen = false; if (cellWidth != SideCellCount) { cellRegen = true; if (SideCellCount > 0) { Destroy(); } SideCellCount = cellWidth; SideVertexCount = SideCellCount * LandDefs.VertexPerCell + 1; SidePolyCount = SideCellCount * LandDefs.VertexPerCell; InitPVArrays(); } TransDir = transAdj; ConstructVertices(); if (TransDir != LandDefs.Direction.Inside && SideCellCount > 1 && SideCellCount < LandDefs.BlockSide) { TransAdjust(); } if (!cellRegen) { AdjustPlanes(); } else { ConstructPolygons(landblockID); if (!PhysicsEngine.Instance.Server) { ConstructNormals(); ConstructUVs(landblockID); // client mode only } } CalcWater(); FinalizePVArrays(); return(cellRegen); }
public new void Init() { InView = BoundingType.Outside; Dir = LandDefs.Direction.Unknown; Closest = new Vector2(-1, -1); BlockCoord = new Vector2(); StaticObjects = new List <PhysicsObj>(); Buildings = new List <BuildingObj>(); }
public void Init() { TransDir = LandDefs.Direction.Unknown; WaterType = LandDefs.WaterType.NotWater; //BlockSurfaceIndex = -1; // init for landcell LandCells = new Dictionary <int, ObjCell>(); for (uint i = 1; i <= 64; i++) { LandCells.Add((int)i, new LandCell((i))); } }