Exemplo n.º 1
0
 // First place of all levelnumbers on entering the scene. id == number to place around
 private static void PlaceLevelNumbers(int id)
 {
     Debug.Log("PlaceLevelNumbers(int id) " + id);
     for (int i = 2; i >= -2; i--)
     {
         int y = -i;
         if (UILevelMatchesLevel(id + i) && !placedLevelNumbers.Any(x => x.id == (id + i)) && !placedLevelNumbers.Any(x => x.position == i) && ProgressManager.GetProgress().storyProgress.lastUnlockedLevel >= id + i)
         {
             //Debug.Log("matches: " + i);
             UILevelNumber nbr = (UILevelNumber)Instantiate(uiLevelNumberPrefab.GetComponent <UILevelNumber>(), Vector3.zero, Quaternion.identity);
             nbr.position = i;
             nbr.id       = id + i;
             nbr.gameObject.transform.parent        = _instance.numberParent.transform;
             nbr.gameObject.transform.localPosition = Vector3.zero;
             placedLevelNumbers.Add(nbr);
         }
         else if (UILevelMatchesLevel(id + y) && !placedLevelNumbers.Any(x => x.id == (id + y)) && !placedLevelNumbers.Any(x => x.position == y) && ProgressManager.GetProgress().storyProgress.lastUnlockedLevel >= id + y)
         {
             //Debug.Log("matches: " + y);
             UILevelNumber nbr = (UILevelNumber)Instantiate(uiLevelNumberPrefab.GetComponent <UILevelNumber>(), Vector3.zero, Quaternion.identity);
             nbr.position = y;
             nbr.id       = id + y;
             nbr.gameObject.transform.parent        = _instance.numberParent.transform;
             nbr.gameObject.transform.localPosition = Vector3.zero;
             placedLevelNumbers.Add(nbr);
         }
     }
 }
Exemplo n.º 2
0
 public static void PlaceLevelNumber(int id, int position)
 {
     if (position < 3 && position > -3)
     {
         if (UILevelMatchesLevel(id) && !placedLevelNumbers.Any(x => x.id == id) && ProgressManager.GetProgress().storyProgress.lastUnlockedLevel >= id)
         {
             UILevelNumber nbr = (UILevelNumber)Instantiate(uiLevelNumberPrefab.GetComponent <UILevelNumber>(), Vector3.zero, Quaternion.identity);
             nbr.position = position;
             nbr.id       = id;
             nbr.gameObject.transform.parent        = _instance.numberParent.transform;
             nbr.gameObject.transform.localPosition = Vector3.zero;
             placedLevelNumbers.Add(nbr);
         }
     }
 }