Example #1
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)));
            }
        }
Example #2
0
        public void CalcWater()
        {
            var hasWater   = false;
            var waterblock = true;

            if (SideCellCount == LandDefs.BlockSide)
            {
                for (var x = 0; x < SideCellCount; x++)
                {
                    for (var y = 0; y < SideCellCount; y++)
                    {
                        bool cellHasWater, cellFullyFlooded;
                        CalcCellWater(x, y, out cellHasWater, out cellFullyFlooded);

                        if (cellHasWater)
                        {
                            hasWater = true;

                            if (cellFullyFlooded)
                            {
                                LandCells[x * SideCellCount + y].WaterType = LandDefs.WaterType.EntirelyWater;
                            }
                            else
                            {
                                LandCells[x * SideCellCount + y].WaterType = LandDefs.WaterType.PartiallyWater;
                                waterblock = false;
                            }
                        }
                        else
                        {
                            LandCells[x * SideCellCount + y].WaterType = LandDefs.WaterType.NotWater;
                            waterblock = false;
                        }
                    }
                }
            }
            WaterType = hasWater ? waterblock ? LandDefs.WaterType.EntirelyWater : LandDefs.WaterType.PartiallyWater : LandDefs.WaterType.NotWater;
        }