Example #1
0
        public SquareWorld(int radius)
        {
            this.edge = radius * 2 - 1;
            var cellCount = this.edge * this.edge;

            int firstX = 1 - radius;
            int firstY = 1 - radius;

            this.bound = IntRange.Inclusive(firstX, -firstX);

            this.offset = 0 - (firstY * this.edge + firstX);

            this.cells = Enumerable
                         .Range(0, cellCount)
                         .Select(_ => new SquareCell())
                         .ToArray();
        }