shaoxiadiablo/Assets/AGame/Scripts/Game/Skill/Bullet_particle2.cs

58 lines
1.3 KiB
C#
Raw Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-02
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "Bullet_particle2" company="Kimch"></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
namespace G
{
public class Bullet_particle2 : MonoBehaviour
{
public float emitfinishdelay;
public float disable_delay;
public float expand_factor;
private Vector3 _originScale;
private void Awake()
{
_originScale = transform.localScale;
}
private void OnEnable()
{
Invoke(nameof(StopEmit), emitfinishdelay);
Invoke(nameof(FinishObj), disable_delay);
GetComponent<ParticleSystem>().Play();
transform.localScale = _originScale;
this.GetComponent<Collider>().enabled = true;
}
private void StopEmit()
{
GetComponent<ParticleSystem>().Stop();
this.GetComponent<Collider>().enabled = false;
}
private void FinishObj()
{
this.gameObject.SetActive(false);
}
private void Update()
{
this.transform.localScale += Vector3.one * (expand_factor * Time.deltaTime);
}
}
}