Esempio n. 1
0
 public Zone(ZoneLayout layout)
 {
     Type   = layout.Type;
     Center = layout.Center;
     Bounds = layout.Bounds;
     Layout = layout;
     _cell  = layout.Cell;
 }
Esempio n. 2
0
        public Bounds2i Intersect(Bounds2i b)
        {
            int x    = Math.Max(Min.X, b.Min.X);
            int num2 = Math.Min(Min.X + Size.X, b.Min.X + b.Size.X);
            int z    = Math.Max(Min.Z, b.Min.Z);
            int num4 = Math.Min(Min.Z + Size.Z, b.Min.Z + b.Size.Z);

            if ((num2 > x) && (num4 > z))
            {
                return(new Bounds2i(new Vector2i(x, z), num2 - x, num4 - z));
            }

            return(Empty);
        }
Esempio n. 3
0
        void OnValidate()
        {
            if (LandSize < 1)
            {
                LandSize = 1;
            }

            //Update Land bounds
            var landMin        = -LandSize / 2;
            var landMax        = landMin + LandSize - 1;
            var minChunkBounds = Chunk.GetBounds(new Vector2i(landMin, landMin));
            var maxChunkBounds = Chunk.GetBounds(new Vector2i(landMax, landMax));

            LayoutBounds = new Bounds2i(minChunkBounds.Min, maxChunkBounds.Max);
        }
Esempio n. 4
0
 public IEnumerable <Vector2i> Substract(Bounds2i b)
 {
     return(this.Where(v => !b.Contains(v)));
 }
Esempio n. 5
0
 public bool Equals(Bounds2i other)
 {
     return(Min == other.Min && Max == other.Max);
 }