TargetAnimal.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TargetAnimal : MonoBehaviour
  5. {
  6. public Transform animalsBaseT {
  7. get {
  8. return this.transform.parent;
  9. }
  10. }
  11. public Vector3 basePosition {
  12. get {
  13. return this.transform.parent.position;
  14. }
  15. }
  16. public Vector3 basePointer {
  17. get {
  18. return this.transform.parent.forward;
  19. }
  20. }
  21. public Vector3 hunterPosition {
  22. get {
  23. return ArmBow.ins.transform.position;
  24. }
  25. }
  26. //获取猎人到我的指针向量
  27. public Vector3 GetPointerHunterToMe() {
  28. Vector3 hunterPos = hunterPosition;
  29. Vector3 myPos = transform.position;
  30. hunterPos.y = myPos.y;
  31. return myPos - hunterPos;
  32. }
  33. public virtual void OnHit(Arrow arrow, Vector3 hitPoint, string partName)
  34. {
  35. }
  36. public void RotateByWorldY(float angle) {
  37. transform.forward = Quaternion.AngleAxis(angle, Vector3.up) * transform.forward;
  38. }
  39. }