SmokeDestroy.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SmokeDestroy : MonoBehaviour
  5. {
  6. public float stayTime;
  7. [HideInInspector]
  8. public float time;
  9. public float hitRate;
  10. public GameObject MissUI;
  11. private void Update()
  12. {
  13. time += Time.deltaTime;
  14. if(time >= stayTime)
  15. {
  16. gameObject.SetActive(false);
  17. }
  18. }
  19. private void OnTriggerEnter(Collider other)
  20. {
  21. AttackTrigger attackTrigger = other.GetComponent<AttackTrigger>();
  22. if (attackTrigger != null && attackTrigger.transform.parent.gameObject.layer == 8)
  23. {
  24. attackTrigger.hitRate = hitRate;
  25. return;
  26. }
  27. CharacterColliders characterColliders = other.GetComponentInParent<CharacterColliders>();
  28. if(characterColliders != null && characterColliders.owner.attackController.attackType == AttackController.AttackType.Shoot)
  29. {
  30. characterColliders.hitRate = hitRate;
  31. }
  32. }
  33. }