Ejemplo n.º 1
0
        private void ChangeCollectable()
        {
            var currentType = PlayerCollectableTypeInfoStore.Get();

            if (currentType == CollectableType)
            {
                return;
            }

            PlayerCollectableTypeInfoStore.Set(CollectableType);
            GlobalEvents.InvokeOnCollectableTypeChange();
        }
Ejemplo n.º 2
0
        private void FillQueue()
        {
            var playersCollectableType = PlayerCollectableTypeInfoStore.Get();
            var availableTiles         = GameManager.Instance.roadManager.GetAllMapTiles.Where(t => t.collectableType == playersCollectableType && t.usableOnInitialMap).ToList();

            while (spawnPos.y < minLength)
            {
                var tile   = availableTiles[Random.Range(0, availableTiles.Count)];
                var tileGO = Instantiate(tile, spawnPos, Quaternion.identity, transform);
                tileGO.gameObject.SetActive(true);
                initialTilesQueue.Enqueue(tileGO);
                spawnPos.y += tile.length;
            }
        }
Ejemplo n.º 3
0
        private Tile[] GetRandomTiles()
        {
            var playersCollectableType = PlayerCollectableTypeInfoStore.Get();
            var availableTiles         = allMapTiles.Where(t => t.collectableType == playersCollectableType).ToList();

            int tileCountInLevel = Random.Range(minTileLengthInALevel, maxTileLengthInALevel + 1);

            var tiles = new Tile[tileCountInLevel];

            for (int i = 0; i < tileCountInLevel; i++)
            {
                tiles[i] = availableTiles[Random.Range(0, availableTiles.Count)];
            }

            return(tiles);
        }