EnemyBounds.cs 755 B

1234567891011121314151617181920212223
  1. using UnityEngine;
  2. using System.Collections;
  3. /// <summary>
  4. /// This is responsible for keeping data for the min and max y in screen coordinates
  5. /// of where this enemy can be spawned.
  6. /// This was mainly created for Formations and Sine Movemements where the enemy spawn manager
  7. /// would need to know this information, so that it doesn't spawn it offscreen.
  8. /// It was kept separate from Enemy class, since not all enemies need this information, and due to Formation
  9. /// not inheriting from Enemy. Kept the component based principles rather than having inheritance
  10. /// </summary>
  11. public class EnemyBounds : MonoBehaviour
  12. {
  13. [HideInInspector]
  14. public float minY;
  15. [HideInInspector]
  16. public float maxY;
  17. public float Range()
  18. {
  19. return maxY - minY;
  20. }
  21. }