PointSignLastHit.cs 846 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. /*
  5. 在静止靶时,
  6. 在左边小靶上保留上次射箭时的箭的位置(高亮点表示)
  7. 下次再射箭时候取消前次高亮点,
  8. 以便用户更好的针对上次射箭的状态进行调整
  9. */
  10. public class PointSignLastHit : MonoBehaviour
  11. {
  12. public static PointSignLastHit ins;
  13. void Start()
  14. {
  15. ins = this;
  16. gameObject.layer = LayerMask.NameToLayer("Test");
  17. Hide();
  18. GameEventCenter.ins.onBowArrowShootOut += (a, b) => {
  19. Hide();
  20. };
  21. }
  22. void OnDestroy()
  23. {
  24. if (ins == this) ins = null;
  25. }
  26. public void Hide() {
  27. gameObject.SetActive(false);
  28. }
  29. public void Show(Vector3 pos) {
  30. transform.position = pos;
  31. gameObject.SetActive(true);
  32. }
  33. }