PlayerEffectSync.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. public class PlayerEffectSync : BaseBehaviour
  3. {
  4. private void Awake()
  5. {
  6. this.m_skeletonAnimation = base.GetComponent<SkeletonAnimation>();
  7. this.animController = R.Player.Action;
  8. this.multiSpineAnimController = R.Player.GetComponent<MultiSpineAnimationController>();
  9. }
  10. private void OnEnable()
  11. {
  12. this.animController.OnPlayerTurnRound += this.StopFollow;
  13. this.multiSpineAnimController.OnAnimChange += new EventHandler<MultiSpineAnimationController.EffectArgs>(this.StopFollow);
  14. }
  15. private void Update()
  16. {
  17. this.m_skeletonAnimation.timeScale = this.multiSpineAnimController.timeScale;
  18. }
  19. private void OnDisable()
  20. {
  21. this.animController.OnPlayerTurnRound -= this.StopFollow;
  22. this.multiSpineAnimController.OnAnimChange -= new EventHandler<MultiSpineAnimationController.EffectArgs>(this.StopFollow);
  23. this.m_skeletonAnimation.Reset();
  24. }
  25. private void StopFollow(object obj, EventArgs e)
  26. {
  27. base.transform.parent = R.Effect.transform;
  28. if (this.isLoop)
  29. {
  30. EffectController.TerminateEffect(base.gameObject);
  31. }
  32. }
  33. private SkeletonAnimation m_skeletonAnimation;
  34. private PlayerAction animController;
  35. private MultiSpineAnimationController multiSpineAnimController;
  36. public bool isLoop;
  37. }