| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using TMPro;
- public class Spirits_Cook : MonoBehaviour
- {
- public GameObject attributeUpEffect;
- public float reductionDegree;
- public float reductionTime;
- public List<MoveCharacter> mcs = new List<MoveCharacter>();
- private void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.layer == 6 || other.gameObject.layer == 7)
- {
- MoveCharacter mc = other.GetComponentInParent<MoveCharacter>();
- if (!mc.isDamageReduction)
- {
- mc.DamageReductionStateOn(reductionDegree, attributeUpEffect);
- mcs.Add(mc);
- }
- }
- }
- private void OnTriggerExit(Collider other)
- {
- if (other.gameObject.layer == 6 || other.gameObject.layer == 7)
- {
- MoveCharacter mc = other.GetComponentInParent<MoveCharacter>();
- if (mc.isDamageReduction)
- {
- mc.DamageReductionStateToOff(reductionTime);
- }
- }
- }
- private void OnDisable()
- {
- foreach(MoveCharacter mc in mcs)
- {
- if (mc.isDamageReduction)
- {
- mc.DamageReductionStateToOff(reductionTime);
- }
- }
- }
- }
|