IEnumerable <DrawingActivityInstance> AddActivityInstances(ILevelSection section)
        {
            var distributor  = new FeatureDistributor();
            var drawingCount = Random.Range(2, 4);

            return(distributor.ScatterElements(Enumerable.Range(0, drawingCount).ToList(),
                                               leftBounds: section.PlayArea.LeftPlayAreaEdge.x,
                                               rightBounds: section.PlayArea.RightPlayAreaEdge.x,
                                               instantiater: (xPos, idx) => new DrawingActivityInstance(Ressi, _root, idx, xPos)));
        }
Exemplo n.º 2
0
    private void PopulateSectionWithActivityObjects(ILevelSection section, GameObject root)
    {
        var distributor = new FeatureDistributor();

        _objectsInActivity = distributor.PlaceConsumables(_prefabCollection, section.PlayArea.LeftPlayAreaEdge.x, section.PlayArea.RightPlayAreaEdge.x);
        foreach (var consumableScript in _objectsInActivity)
        {
            consumableScript.OnConsume        = ConsumeObject;
            consumableScript.transform.parent = root.transform;
        }
    }
Exemplo n.º 3
0
        void PopulateSectionWithActivityObjects(ILevelSection section)
        {
            var distributor = new FeatureDistributor();
            var consumables = distributor.PlaceConsumables(_prefabCollection, section.PlayArea.LeftPlayAreaEdge.x, section.PlayArea.RightPlayAreaEdge.x);

            foreach (var consumable in consumables)
            {
                consumable.OnConsume        = ConsumeObject;
                consumable.transform.parent = _root.transform;
                _objectsInActivity.Add(consumable);
            }
        }
Exemplo n.º 4
0
    void SpawnLetterPreviews()
    {
        var distinctLetters = _objectsInActivity
                              .OfType <ConsumableLetter>()
                              .Distinct(new ConsumableLetterComparer())
                              .OrderByDescending(i => i.Letter)
                              .ToList();

        var screenSize = Camera.main.OrthographicBounds();
        var halfWidth  = screenSize.extents.x / 2;

        var yPos      = screenSize.center.y + (screenSize.extents.y / 2);
        var center    = Section.PlayArea.RightTerrainEdge.x;
        var leftEdge  = center - halfWidth;
        var rightEdge = center + halfWidth;

        var featureDistributor = new FeatureDistributor();

        _letterPreview = featureDistributor.ScatterElements <ConsumableLetter, GameObject>(distinctLetters, leftEdge, rightEdge,
                                                                                           (xPos, letter) => InstantiateLetterPreview(xPos, yPos, letter), varyPosition: false, shuffle: false)
                         .ToList();
    }