Пример #1
0
        public SimpleTileLayer(LayerType layerType, int width, int height, Random random = null)
        {
            if (width <= 0)
            {
                throw new ArgumentOutOfRangeException("width", "Tile width has to be positive");
            }
            if (height <= 0)
            {
                throw new ArgumentOutOfRangeException("height", "Tile height has to be positive");
            }
            Contract.EndContractBlock();

            m_random = random ?? new Random();

            switch (layerType)
            {
            case LayerType.Background:
                SpanIntervalFrom = 0;
                break;

            case LayerType.Foreground:
                SpanIntervalFrom = DEFAULT_THICKNESS * 2;
                break;

            default:
                SpanIntervalFrom = DEFAULT_THICKNESS;
                break;
            }

            switch (layerType)
            {
            case LayerType.OnGroundInteractable:
                Thickness = 0.2f;
                break;

            case LayerType.OnBackground:
                Thickness = 0.1f;
                break;

            default:
                Thickness = DEFAULT_THICKNESS;
                break;
            }

            Height = height;
            Width  = width;

            LayerType       = layerType;
            m_summerCache.Z = m_random.Next();

            Tiles = ArrayCreator.CreateJaggedArray <Tile[][]>(width, height);

            Render = true;
        }
Пример #2
0
        public AreasCarrier(ITileLayer pathLayer, ITileLayer areaLayer, List <Tuple <Vector2I, string> > positionsNamesTuples)
        {
            Rooms     = ArrayCreator.CreateJaggedArray <Room[][]>(pathLayer.Width, pathLayer.Height);
            AreaNames = ArrayCreator.CreateJaggedArray <string[][]>(pathLayer.Width, pathLayer.Height);

            foreach (Tuple <Vector2I, string> positionNameTuple in positionsNamesTuples)
            {
                Vector2I position = positionNameTuple.Item1;
                string   name     = positionNameTuple.Item2;
                FillNamedArea(position.X, position.Y, name, pathLayer, areaLayer);
            }
        }