LandingButtons.cs 1.1 KB

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. public class LandingButtons:MonoBehaviour{
  3. //Simple GUI script demo controlling bird flock and landing spots.
  4. public LandingSpotController _landingSpotController;
  5. public FlockController _flockController;
  6. public float hSliderValue = 250.0f;
  7. public void OnGUI() {
  8. GUI.Label(new Rect(20.0f,20.0f,125.0f,18.0f),"Landing Spots: " + _landingSpotController.transform.childCount);
  9. if(GUI.Button(new Rect(20.0f,40.0f,125.0f,18.0f),"Scare All"))
  10. _landingSpotController.ScareAll();
  11. if(GUI.Button(new Rect(20.0f,60.0f,125.0f,18.0f),"Land In Reach"))
  12. _landingSpotController.LandAll();
  13. if(GUI.Button(new Rect(20.0f,80.0f,125.0f,18.0f),"Land Instant"))
  14. StartCoroutine(_landingSpotController.InstantLand(0.01f));
  15. if(GUI.Button(new Rect(20.0f,100.0f,125.0f,18.0f),"Destroy")){
  16. _flockController.destroyBirds();
  17. }
  18. GUI.Label(new Rect(20.0f,120.0f,125.0f,18.0f),"Bird Amount: " + _flockController._childAmount);
  19. _flockController._childAmount = (int)GUI.HorizontalSlider(new Rect (20.0f, 140.0f, 125.0f, 18.0f), (float)_flockController._childAmount, 0.0f , 250.0f);
  20. }
  21. }