Esempio n. 1
0
    /// <summary>
    /// Sets up board according to rules
    /// </summary>
    /// <param name="rules"></param>
    public void InitBoard(LevelRules rules)
    {
        grid = GetComponent <Grid>();
        grid.BuildBoard();

        tilePot = GetComponent <TilePot>();
        tilePot.ConfigurePot(rules);

        SpawnFreshBoard();
    }
Esempio n. 2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
    public void StartLevel(LevelRules rules)
    {
        if (rules.Index - 1 > levelIndex)
        {
            return;
        }

        GameManager.Instance.Configure(rules);

        HideLevelSelect();
    }
Esempio n. 4
0
    public void Configure(LevelRules rules)
    {
        if (!rules || !rules.GameBoard)
        {
            throw new Exception("Invalid ruleset / game board!");
        }

        this.rules = rules;

        InitNewData();
        InitGameBoard();

        AudioManager.Instance.PlayAudio(Sound.LevelIntro);
    }
    private void SpawnLevelCards()
    {
        for (int i = 0; i < levelRules.Length; i++)
        {
            Button card = Instantiate(cardPrefab, cardHolder);
            cards.Add(card);

            LevelRules rules = levelRules[i];

            cards[i].onClick.AddListener(() =>
            {
                StartLevel(rules);
            });

            cards[i].GetComponentInChildren <TextMeshProUGUI>().text = rules.Index.ToString();
        }
    }
Esempio n. 6
0
 /// <summary>
 /// Sets up a tile pot according to current level settings.
 /// </summary>
 /// <param name="rules"></param>
 public void ConfigurePot(LevelRules rules)
 {
     this.rules = rules;
     RegenerateDistribution();
 }