DaoPart.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using UnityEngine;
  3. public class DaoPart : BaseBehaviour
  4. {
  5. private bool isOnGround
  6. {
  7. get
  8. {
  9. RaycastHit2D hit = Physics2D.Raycast(base.transform.position, -Vector2.up, 0.5f, LayerManager.GroundMask | LayerManager.OneWayGroundMask | LayerManager.ObstacleMask);
  10. return hit;
  11. }
  12. }
  13. private void Awake()
  14. {
  15. this.anim = base.GetComponent<SkeletonAnimation>();
  16. this._animName = this.anim.AnimationName;
  17. }
  18. private void Update()
  19. {
  20. if (this.isOnGround && !this.hitGround)
  21. {
  22. this.hitGround = true;
  23. this.anim.state.SetAnimation(0, "HitGround", false);
  24. R.Effect.Generate(163, null, new Vector3(base.transform.position.x, base.transform.position.y, base.transform.position.z - 0.1f), Vector3.zero, default(Vector3), true);
  25. }
  26. }
  27. private void OnDisable()
  28. {
  29. this.anim.state.SetAnimation(0, this._animName, true);
  30. this.hitGround = false;
  31. this.anim.Reset();
  32. }
  33. private SkeletonAnimation anim;
  34. private bool hitGround;
  35. private string _animName;
  36. }