// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-02
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
//
//
// ***********************************************************************
using UnityEngine;
namespace G
{
///
///
///
public class Bullet_particle : MonoBehaviour
{
public float start_delay;
public float active_delay;
public float disable_delay;
private ParticleSystem _particle;
private float _currentTime;
private Collider _collider;
private bool _colliderExist;
private void Awake()
{
_particle = this.GetComponent();
_collider = this.GetComponent();
if (_collider)
{
_colliderExist = true;
}
this.gameObject.SetActive(false);
}
private void OnEnable()
{
_currentTime = 0f;
if (_particle)
_particle.Stop();
if (_colliderExist)
{
_collider.enabled = false;
}
}
private void Update()
{
_currentTime += Time.deltaTime;
if (_currentTime >= disable_delay)
{
this.gameObject.SetActive(false);
}
if (_currentTime >= active_delay)
{
if (_particle)
_particle.Stop();
if (_colliderExist)
{
_collider.enabled = false;
}
}
else if (_currentTime >= start_delay)
{
if (_particle)
_particle.Play();
if (_colliderExist)
{
_collider.enabled = true;
}
}
}
}
}