PointSignLastHit.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. //不是GameDouble按照以前的Test处理
  17. //if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name != "GameDouble")
  18. {
  19. gameObject.layer = LayerMask.NameToLayer("Test");
  20. }
  21. Hide();
  22. GameEventCenter.ins.onBowArrowShootOut += (a, b) => {
  23. Hide();
  24. };
  25. }
  26. void OnDestroy()
  27. {
  28. if (ins == this) ins = null;
  29. }
  30. public void Hide() {
  31. gameObject.SetActive(false);
  32. }
  33. public void Show(Vector3 pos) {
  34. transform.position = pos;
  35. gameObject.SetActive(true);
  36. }
  37. }