FlockWaypointTrigger.cs 436 B

1234567891011121314151617
  1. using UnityEngine;
  2. public class FlockWaypointTrigger:MonoBehaviour{
  3. public float _timer =1.0f;
  4. public FlockChild _flockChild;
  5. public void Start() {
  6. if(_flockChild == null)
  7. _flockChild = transform.parent.GetComponent<FlockChild>();
  8. float timer = Random.Range(_timer, _timer*3);
  9. InvokeRepeating("Trigger", timer, timer);
  10. }
  11. public void Trigger() {
  12. _flockChild.Wander(0.0f);
  13. }
  14. }