| 12345678910111213141516171819202122232425262728293031323334353637 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SmokeDestroy : MonoBehaviour
- {
- public float stayTime;
- [HideInInspector]
- public float time;
- public float hitRate;
- public GameObject MissUI;
- private void Update()
- {
- time += Time.deltaTime;
- if(time >= stayTime)
- {
- gameObject.SetActive(false);
- }
- }
- private void OnTriggerEnter(Collider other)
- {
- AttackTrigger attackTrigger = other.GetComponent<AttackTrigger>();
- if (attackTrigger != null && attackTrigger.transform.parent.gameObject.layer == 8)
- {
- attackTrigger.Miss = MissUI;
- attackTrigger.hitRate = hitRate;
- return;
- }
- CharacterColliders characterColliders = other.GetComponentInParent<CharacterColliders>();
-
- if(characterColliders != null && characterColliders.owner.attackType == AttackType.Shoot)
- {
- characterColliders.smoke = gameObject;
- characterColliders.hitRate = hitRate;
- }
- }
- }
|