ButtonBuilding.cs 665 B

1234567891011121314151617181920212223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using WebTools.Currencies.Behaviours;
  5. using DataTools;
  6. namespace ANTM.EnviromentSystem
  7. {
  8. public class ButtonBuilding : MonoBehaviour
  9. {
  10. [Header("DATAUSER")]
  11. [SerializeField]
  12. private DataUser dataUser;
  13. public int levelRequired;
  14. public Sprite unlocked;
  15. public Sprite locked;
  16. void OnEnable () {
  17. GetComponent<BoxCollider2D>().enabled = dataUser.UserData.CurrencyData.Experience >= levelRequired;
  18. GetComponent<SpriteRenderer>().sprite = dataUser.UserData.CurrencyData.Experience >= levelRequired ? unlocked : locked;
  19. }
  20. }
  21. }