RockBehitTrigger.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class RockBehitTrigger : BeHitTrigger
  5. {
  6. public int attackTime = 2;
  7. public int curAttackTime = 0;
  8. public string fatName = "¶Ü¼×±ø";
  9. public RockRoller rock;
  10. protected override void OnEnable()
  11. {
  12. base.OnEnable();
  13. curAttackTime = 0;
  14. }
  15. public override void BeHit(AttackController.AttackMethod attackMethod, Character attackFrom)
  16. {
  17. if (attackMethod.attackInfo.attackMethod_Type == AttackMethod_Type.Attack_March)
  18. {
  19. return;
  20. }
  21. if (attackFrom.gameObject.GetComponent<Demonic>() != null)
  22. {
  23. if (attackFrom.gameObject.GetComponent<Demonic>().myName == fatName)
  24. {
  25. if (curAttackTime == attackTime - 1)
  26. {
  27. owner.BeHit(attackMethod, attackFrom);
  28. //rock.changeSpriter(curAttackTime+1);
  29. rock.changeScale(curAttackTime + 1);
  30. curAttackTime = 0;
  31. }
  32. else
  33. {
  34. curAttackTime += 1;
  35. //rock.changeSpriter(curAttackTime);
  36. rock.changeScale(curAttackTime);
  37. }
  38. }
  39. else
  40. {
  41. base.BeHit(attackMethod, attackFrom);
  42. }
  43. }
  44. else
  45. {
  46. base.BeHit(attackMethod, attackFrom);
  47. }
  48. }
  49. protected override void OnDisable()
  50. {
  51. base.OnDisable();
  52. curAttackTime = 0;
  53. }
  54. }