StabSword.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class StabSword : BaseBehaviour
  5. {
  6. private void Start()
  7. {
  8. }
  9. private void OnEnable()
  10. {
  11. if (SingletonMono<WorldTime>.Instance != null)
  12. {
  13. }
  14. }
  15. private void OnDisable()
  16. {
  17. if (SingletonMono<WorldTime>.Instance != null)
  18. {
  19. }
  20. base.StopCoroutine("MultiStab");
  21. }
  22. private void OnDestroy()
  23. {
  24. }
  25. private void Update()
  26. {
  27. }
  28. public void ShowStabSword()
  29. {
  30. base.StartCoroutine(this.MultiStab(20));
  31. }
  32. private IEnumerator MultiStab(int times)
  33. {
  34. for (;;)
  35. {
  36. if (!this.isPause)
  37. {
  38. GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.stabEffect);
  39. gameObject.transform.parent = base.transform;
  40. gameObject.transform.localScale = new Vector3(0.8333334f, 0.8333334f, 1f);
  41. gameObject.transform.localPosition = new Vector3(0.2f, -0.1f, 0f);
  42. gameObject.transform.localRotation = Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(-16, 17));
  43. }
  44. yield return new WaitForSeconds(0.03f);
  45. }
  46. yield break;
  47. }
  48. private void ClipFrozen(object obj, EventArgs e)
  49. {
  50. if (this.isPause)
  51. {
  52. return;
  53. }
  54. this.isPause = true;
  55. this.newEffectAnim.speed = 0f;
  56. this.oldEffectAnim.speed = 0f;
  57. }
  58. private void ClipResume(object obj, EventArgs e)
  59. {
  60. if (!this.isPause)
  61. {
  62. return;
  63. }
  64. this.newEffectAnim.speed = 1f;
  65. this.oldEffectAnim.speed = 1f;
  66. this.isPause = false;
  67. }
  68. [SerializeField]
  69. private GameObject stabEffect;
  70. [SerializeField]
  71. private Animator newEffectAnim;
  72. [SerializeField]
  73. private Animator oldEffectAnim;
  74. public bool isPause;
  75. }