Exemplo n.º 1
0
    public string[] AllActiveLevels()
    {
        List <string> returnList   = new List <string>();
        LevelBundle   previous     = null;
        int           playedLevels = 0;

        foreach (LevelBundle bundle in bundles)
        {
            if (previous != null)
            {
                foreach (string level in previous.levels)
                {
                    if (Scores.GetHighscore(level) > 0)
                    {
                        playedLevels++;
                    }
                }
            }

            if (previous == null || playedLevels >= 2)
            {
                foreach (string level in bundle.levels)
                {
                    returnList.Add(level);
                }
                previous     = bundle;
                playedLevels = 0;
                continue;
            }
            break;
        }
        Debug.Log(returnList.Count);
        return(returnList.ToArray());
    }
Exemplo n.º 2
0
    private void CreateBundle(LevelBundle bundle, int yPosition)
    {
        GameObject myBundle = (GameObject)Instantiate(levelBundlePrefab, levelList);

        myBundle.name = bundle.name;
        myBundle.transform.localPosition = new Vector3(0f, -150f - 300f * yPosition, 0f);
        myBundle.GetComponent <BundleObject>().Init(bundle);
    }
Exemplo n.º 3
0
 public void Init(LevelBundle bundle)
 {
     bundleName.text = bundle.name;
     for (int i = 0; i < bundle.levels.Length; i++)
     {
         if (LevelManager.currentLevel != null && LevelManager.currentLevel.name == bundle.levels[i])
         {
             levelButton[i].GetComponentInChildren <Text>().color = highlightTextColor;
             levelButton[i].colors = highlightBackgroundColors;
         }
         levelButton[i].transform.GetChild(0).GetComponent <Text>().text = "\t\t" + bundle.levels[i];
         levelButton[i].transform.GetChild(1).GetComponent <Text>().text = Scores.GetHighscore(bundle.levels[i]) + "\t\t";
         string levelName = bundle.levels[i];
         Button me        = levelButton[i];
         levelButton[i].onClick.AddListener(delegate { GameLevelLoader.LoadLevel(levelName); me.interactable = false; });
     }
 }