FishMove.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using UnityEngine;
  3. using wf;
  4. [RequireComponent(typeof(iTweenPath))]
  5. public class FishMove : MonoBehaviour
  6. {
  7. private void Start()
  8. {
  9. Vector3[] path = iTweenPath.GetPath(this.PathName);
  10. for (int i = 0; i < this.DuplicationObjectCount; i++)
  11. {
  12. GameObject childObject = UTY.GetChildObject(base.gameObject, "ObjectRoot", false);
  13. GameObject gameObject = Utility.CreatePrefab(new GameObject("Fish" + i)
  14. {
  15. transform =
  16. {
  17. parent = childObject.transform
  18. }
  19. }, this.CreatePrefabName, false);
  20. gameObject.transform.localPosition = path[0];
  21. gameObject.transform.rotation = this.FirstDirection;
  22. Fish fish = gameObject.AddComponent<Fish>();
  23. fish.Init(path, this.MinTime, this.MaxTime, this.LookTime);
  24. fish.MovePath();
  25. }
  26. }
  27. public float MinTime = 6f;
  28. public float MaxTime = 12f;
  29. public float LookTime = 2f;
  30. public string PathName = "Path1";
  31. public int DuplicationObjectCount = 1;
  32. public string CreatePrefabName = string.Empty;
  33. public Quaternion FirstDirection = Quaternion.identity;
  34. }