SceneEventMoonWellLogic.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityGameFramework.Runtime;
  6. /// <summary>
  7. /// 场景组件 月亮井
  8. /// </summary>
  9. public class SceneEventMoonWellLogic : MonoBehaviour
  10. {
  11. private float speed = 0;
  12. private float fullTime = 5;
  13. private float nowTimeCount = 0;
  14. private bool isFull = false;
  15. private void Awake()
  16. {
  17. }
  18. // Start is called before the first frame update
  19. void Start()
  20. {
  21. }
  22. public void Update()
  23. {
  24. if (!isFull)
  25. {
  26. nowTimeCount += Time.deltaTime;
  27. if (nowTimeCount > fullTime)
  28. {
  29. Animator anim = this.GetComponent<Animator>();
  30. anim.Play("full");
  31. isFull = true;
  32. nowTimeCount = 0;
  33. }
  34. }
  35. }
  36. public void OnTriggerStay(Collider collider)
  37. {
  38. Role role = collider.GetComponent<Role>();
  39. if (!role || role.isDie)
  40. {
  41. return;
  42. }
  43. if (isFull)
  44. {
  45. X2Battle.X2BattleManager.Instance.mBulletModel.OnCastSkill(
  46. 0, "602101",
  47. false, X2Battle.EBulletCastPoint.ECAST_POINT_DEFLUAT, role.mData.UID, false);
  48. isFull = false;
  49. Animator anim = this.GetComponent<Animator>();
  50. anim.Play("empty");
  51. }
  52. }
  53. public void OnTriggerEnter(Collider collider)
  54. {
  55. Role role = collider.GetComponent<Role>();
  56. if (role && isFull)
  57. {
  58. X2Battle.X2BattleManager.Instance.mBulletModel.OnCastSkill(
  59. 0, "602101",
  60. false, X2Battle.EBulletCastPoint.ECAST_POINT_DEFLUAT, role.mData.UID, false);
  61. isFull = false;
  62. Animator anim = this.GetComponent<Animator>();
  63. anim.Play("empty");
  64. }
  65. }
  66. public void OnTriggerExit(Collider collider)
  67. {
  68. }
  69. public void EnableCollider()
  70. {
  71. }
  72. public void OnClickInteractive()
  73. {
  74. }
  75. }