SpawnCfg.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public delegate void SpawnPointAllDeadEvent(SpawnCfg spawnCfg);
  5. public delegate void OnAllSpawned(SpawnCfg spawnCfg);
  6. public class SpawnCfg : FuncRegion
  7. {
  8. [HideInInspector]
  9. public Color PointColor = new Color(1, 0, 0);
  10. [HideInInspector]
  11. public float radius = 0.25f;
  12. public int ConfigId;
  13. public ActorType actorType;
  14. public SpawnCfg nextPoint;
  15. public event SpawnPointAllDeadEvent onAllDeadEvt;
  16. public event OnAllSpawned onAllSpawned;
  17. protected List<Fighter> mSpawnedList = new List<Fighter>();
  18. protected List<SpawnCfg> mSpawnCfgList = new List<SpawnCfg>();
  19. protected int mSpawnPointOver;
  20. protected virtual void Start()
  21. {
  22. }
  23. protected void OnDestroy()
  24. {
  25. }
  26. public override void UpdateLogic(float delta)
  27. {
  28. }
  29. protected virtual void DecSpawnPointOver()
  30. {
  31. if (--mSpawnPointOver == 0)
  32. {
  33. if (onAllDeadEvt != null)
  34. {
  35. onAllDeadEvt(this);
  36. }
  37. }
  38. }
  39. void OnDrawGizmos()
  40. {
  41. Gizmos.color = PointColor;
  42. Gizmos.DrawSphere(transform.position, 0.15f);
  43. }
  44. public List<Fighter> GetSpawnedList()
  45. {
  46. return mSpawnedList;
  47. }
  48. }