Spirits_Cook.cs 977 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using TMPro;
  5. public class Spirits_Cook : MonoBehaviour
  6. {
  7. public GameObject attributeUpEffect;
  8. public float reductionDegree;
  9. public float reductionTime;
  10. private void OnTriggerEnter(Collider other)
  11. {
  12. if (other.gameObject.layer == 6 || other.gameObject.layer == 7)
  13. {
  14. MoveCharacter mc = other.GetComponentInParent<MoveCharacter>();
  15. if (!mc.isDamageReduction)
  16. {
  17. mc.DamageReductionStateOn(reductionDegree, attributeUpEffect);
  18. }
  19. }
  20. }
  21. private void OnTriggerExit(Collider other)
  22. {
  23. if (other.gameObject.layer == 6 || other.gameObject.layer == 7)
  24. {
  25. MoveCharacter mc = other.GetComponentInParent<MoveCharacter>();
  26. if (!mc.isDamageReduction)
  27. {
  28. mc.DamageReductionStateToOff(reductionTime);
  29. }
  30. }
  31. }
  32. }