Beispiel #1
0
        void Start()
        {
            var tileLookUp = new Dictionary <char, GameObject> ();

            foreach (var t in tilePrefabs)
            {
                tileLookUp.Add(t.textRepresentation, t.prefab);
            }

            _levelBuilder = new LevelBuilder(tileLookUp);

            _chucks = GetComponents <LevelChunk> ();
            foreach (var c in _chucks)
            {
                if (preLoadLevelDataFromFile)
                {
                    c.Initialise();
                }
                _totalWeight += c.weight;
            }

            for (int i = 0; i < chucksToPreLoad; i++)
            {
                SpawnWeightAdjustedChunk();
            }
        }
        void Start()
        {
            if (tilePrefabs.Length == 0)
            {
                Debug.LogError("Please setup tile prefabs");
                enabled = false;
                return;
            }

            var tileLookUp = new Dictionary <char, GameObject> ();

            foreach (var t in tilePrefabs)
            {
                tileLookUp.Add(t.textRepresentation, t.prefab);
            }

            GameObject obj = new LevelBuilder(tileLookUp).BuildChunkAtPosition(transform.position, new LevelLoader(levelFileName).LoadLevel());

            obj.transform.SetParent(transform);
        }