Esempio n. 1
0
        private void PrepareFirstSegment(GameSettings settings)
        {
            Map.Clear();
            _generator.ResetState();

            _generator.SegmentWidth  = settings.FirstTileSize;
            _generator.MinSegmentLen = 1;
            _generator.MaxSegmentLen = 1;

            var _firstSegment = RequestNextSegment();

            _generator.SegmentWidth  = settings.TileWidth;
            _generator.MinSegmentLen = settings.SegmentMinLen;
            _generator.MaxSegmentLen = settings.SegmentMaxLen;

            _mapView.ReCreate(_firstSegment, RequestNextSegment);
        }
Esempio n. 2
0
        public void ReCreate(Segment firstSegment, RequestNextSegment requestNextSegment)
        {
            foreach (var segment in _segments.Concat(_segmentsTransitionToPool))
            {
                ReturnSegment(segment);
            }
            _segments.Clear();
            _segmentsTransitionToPool.Clear();
            _requestNextSegment = requestNextSegment;

            _lastSegmentPosMap  = Vector2.zero;
            _lastSegmentSizeMap = Vector2.zero;
            ExpandMap(firstSegment);

            var firstSegmentView = _segments.Peek();

            _firstSegmentPosWorld = GetFarCornerOfSegment(firstSegmentView);
        }