CombatAlertManager.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using UnityEngine;
  2. using Utility;
  3. namespace GameLogic.CombatScenesTool
  4. {
  5. public class CombatAlertManager : Singleton<CombatAlertManager>
  6. {
  7. public BetterList<AlertBuffer> alertList = new BetterList<AlertBuffer>();
  8. public class AlertBuffer
  9. {
  10. public GameObject GameObject;
  11. public Collider realCollider;
  12. public CombatHeroEntity targetEntity;
  13. }
  14. public void AddAlert(GameObject gameObject, CombatHeroEntity targetEntity)
  15. {
  16. AlertBuffer alertBuffer = new AlertBuffer();
  17. alertBuffer.GameObject = gameObject;
  18. alertBuffer.realCollider = gameObject.GetComponent<Collider>();
  19. alertBuffer.targetEntity = targetEntity;
  20. alertList.Add(alertBuffer);
  21. }
  22. public void RemoveAlert(GameObject gameObject)
  23. {
  24. for (int i = 0; i < alertList.Count; i++)
  25. {
  26. if (alertList[i].GameObject == gameObject)
  27. {
  28. alertList.RemoveAt(i);
  29. return;
  30. }
  31. }
  32. }
  33. }
  34. }