TreePath.cs 605 B

1234567891011121314151617181920212223242526
  1. using PathCreation;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class TreePath : MonoBehaviour
  6. {
  7. public List<PathCreator> paths;
  8. public PathCreator GetPath()
  9. {
  10. int randomInt = Random.Range(0, paths.Count);
  11. return paths[randomInt];
  12. }
  13. private void OnTriggerEnter(Collider other)
  14. {
  15. if (other.gameObject.layer == 8)
  16. {
  17. Monkey enemy = other.GetComponentInParent<Monkey>();
  18. enemy.pathCreator = GetPath();
  19. enemy.ChangeMonkeyState(Monkey.MonkeyState.Climb);
  20. }
  21. }
  22. }