DummyNode.cs 953 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace CommonAIClient.Unity.Utils
  4. {
  5. public class DummyNode : MonoBehaviour
  6. {
  7. private string mDummyName;
  8. private GameObject mTraceObject;
  9. public bool Init(string name, GameObject traceObject)
  10. {
  11. if (string.IsNullOrEmpty(name))
  12. {
  13. Debug.LogError("string.IsNullOrEmpty(DummyName)");
  14. return false;
  15. }
  16. mDummyName = name;
  17. mTraceObject = traceObject;
  18. gameObject.name = "DummyNode_" + name;
  19. return true;
  20. }
  21. // Update is called once per frame
  22. void Update()
  23. {
  24. if (mTraceObject != null && mTraceObject.activeInHierarchy)
  25. {
  26. transform.position = mTraceObject.Position();
  27. transform.rotation = mTraceObject.Rotation();
  28. }
  29. }
  30. }
  31. }