You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1012 B

5 years ago
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using UnityEngine;
  4. namespace Plugins.Isolationist
  5. {
  6. public class IsolateInfo : MonoBehaviour
  7. {
  8. private static IsolateInfo _instance;
  9. private static bool _searched;
  10. public List<GameObject> FocusObjects;
  11. public List<GameObject> HiddenObjects;
  12. public static IsolateInfo Instance { get { return _instance ? _instance : (_instance = FindObjectOfType<IsolateInfo>()); } set { _instance = value; } }
  13. public static bool IsIsolated
  14. {
  15. get {
  16. if (!_searched)
  17. {
  18. _instance = FindObjectOfType<IsolateInfo>();
  19. _searched = true;
  20. }
  21. return _instance;
  22. }
  23. }
  24. public static void Hide() { if (Instance && Instance.HiddenObjects != null) Instance.HiddenObjects.Where(go => go).ToList().ForEach(go => go.SetActive(false)); }
  25. public static void Show() { if (Instance && Instance.HiddenObjects != null) Instance.HiddenObjects.Where(go => go).ToList().ForEach(go => go.SetActive(true)); }
  26. private void Awake() { Show(); }
  27. }
  28. }