using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Flags : MonoBehaviour {
  public int debugLevel = 0;
  public Sprite golemIcon;
  public bool HoldingRedCrystal;
  public bool FoundAnyRedCrystal;

  private int _golemBondLevel;
  public int GolemBondLevel {
    get {
      if (debugLevel > 0) {
        return debugLevel;
      }
      return _golemBondLevel;
    }
  }

  public bool KnowsCommand(int level) {
    return level <= GolemBondLevel;
  }

  public void LevelUpGolemBond(int level) {
    if (level <= _golemBondLevel) {
      return;
    }
    _golemBondLevel = level;
    switch (level) {
      case 1:
        UI.Instance.ShowTutorial("Golem", Messages.Bond1, golemIcon);
        AudioController.Instance.StartMusic1();
        break;
      case 2:
        UI.Instance.ShowTutorial("Golem", Messages.Bond2, golemIcon);
        AudioController.Instance.PlaySuccess2();
        break;
      default:
        break;
    }
  }

  private static Flags _instance;
  public static Flags Instance {
    get {
      if (_instance == null) {
        _instance = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren<Flags>();
      }
      return _instance;
    }
  }
}
