Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- namespace GameStudioName
- {
- public class InventoryNotifier : MonoBehaviour
- {
- [SerializeField] private InventoryFilters filter;
- [SerializeField] private GameObject notifyIconPrefab;
- [SerializeField] private Transform notifyIconContainer;
- private GameObject notifyIcon;
- public InventoryFilters Filter => filter;
- private void Start()
- {
- InventoryWatcher.Current.RegisterNotifier(this);
- }
- public void OnNotify(bool enabled)
- {
- if (enabled && notifyIcon == null)
- notifyIcon = Instantiate(notifyIconPrefab, notifyIconContainer, false);
- else if (!enabled && notifyIcon != null)
- Destroy(notifyIcon);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement