Exemplo n.º 1
0
 /// <summary>
 /// Selects a random category between the "difficult" ones, and gets a random level of the
 /// category selected.
 /// Sets isChallenge true
 /// </summary>
 public void SetRandomChallenge()
 {
     GameManager.LEVEL_CATEGORY category = (GameManager.LEVEL_CATEGORY)Random.Range((int)GameManager.LEVEL_CATEGORY.ADVANCED, (int)GameManager.LEVEL_CATEGORY.CHALLENGE); // [ADVANCED, CHALLENGE) MASTER INCLUIDO
     StartLevelCategory(category);
     SetCurrentLevel(Random.Range(0, 100));
     _isChallenge = true;
 }
Exemplo n.º 2
0
    /// <summary>
    /// This method reads the maps of a given category, which are read previously from
    /// the Resources folder. Is loaded as a TextAsset, and readed as a text when we want to read
    /// all its content. Once all this is done, the filled list is returned.
    /// </summary>
    /// <param name="category">category from where we want to get the levels
    public List <Level> CreateLevels(GameManager.LEVEL_CATEGORY category)
    {
        _levels.Clear();
        TextAsset map = (TextAsset)Resources.Load("Maps/" + category, typeof(TextAsset));

        _levels = Newtonsoft.Json.JsonConvert.DeserializeObject <List <Level> >(map.text);

        return(_levels);
    }
Exemplo n.º 3
0
 /// <summary>
 /// Getter for the sprite of the category given
 /// </summary>
 /// <param name="c">category from where we want to get the sprite
 ///
 private void Start()
 {
     GameManager.LEVEL_CATEGORY category = GameManager.Instance.GetCurrentCategory();
     if (!GameManager.Instance.IsChallenge())
     {
         this.GetComponent <UnityEngine.UI.Image>().sprite = this.GetCategory((int)category - 1);
     }
     else
     {
         this.GetComponent <UnityEngine.UI.Image>().sprite = this.GetCategory((int)GameManager.LEVEL_CATEGORY.CHALLENGE - 1);
     }
 }