2025-05-18 01:04:31 +08:00

85 lines
1.6 KiB
C#

// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-16
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
// <copyright file= "Ef_split1" company="KUNPO"></copyright>
// <summary></summary>
// ***********************************************************************
using UnityEngine;
namespace G
{
/// <summary>
///
/// </summary>
public class Ef_split1 : MonoBehaviour
{
private float _destroyDelay;
private float _alphaDelay;
private Mesh _mesh;
private Color _color = Color.white;
private readonly Color[] _tempColors = new Color[4];
private void Awake()
{
_mesh = GetComponent<MeshFilter>().mesh;
}
private void Start()
{
this.gameObject.SetActive(false);
}
public void FinishNow()
{
_destroyDelay = 5f;
}
private void Update()
{
_destroyDelay += Time.deltaTime;
if (_destroyDelay > 4f)
{
transform.position = Vector3.one * 3f;
_color = Color.white;
_destroyDelay = 0f;
for (int i = 0; i < 4; i++)
{
_tempColors[i] = Color.white;
}
_mesh.colors = _tempColors;
this.gameObject.SetActive(false);
}
else
{
if (_destroyDelay <= 3f)
{
return;
}
_color = Color.Lerp(_color, Color.clear, Time.deltaTime * 5f);
if (_alphaDelay > 0.1f)
{
for (int j = 0; j < 4; j++)
{
_tempColors[j] = _color;
}
_alphaDelay = 0f;
_mesh.colors = _tempColors;
}
else
{
_alphaDelay += Time.deltaTime;
}
}
}
}
}