示例#1
0
        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);
        }
示例#2
0
 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>();
 }
示例#3
0
        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)));
            }
        }