Beispiel #1
0
 public Path(int level, Character[] allies, AudioManager audioManager)
 {
     this.audioManager = audioManager;
     this.level        = level;
     this.allies       = LevelsConfiguration.UpdateAllies(allies, this.level);
     this.rooms        = LevelsConfiguration.GetRooms(level);
 }
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        _levelsConfiguration = Resources.Load <LevelsConfiguration>("LevelsConfiguration");

        _currentLevel = PlayerPrefs.HasKey("CurrentLevel")
            ? PlayerPrefs.GetInt("CurrentLevel")
            : 1;

        // updates the UI with the corresponding level fruit notations
        foreach (var fruit in GetCurrentLevel().LevelFruits.Where(f => f != LevelFruit.None))
        {
            var levelFruit = Instantiate(LevelPrefab, LevelContainer.transform);
            levelFruit.GetComponent <Image>().sprite = GameController.Instance.GetFruitSpriteFromData(fruit);
        }
    }