/// <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(); }
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(); }
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(); } }
/// <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(); }