UMiniGame/Assets/Games/Scripts/RecycleImpact.cs
2025-12-27 15:29:20 +08:00

45 lines
893 B
C#

using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using UnityEngine;
public class RecycleImpact : MonoBehaviour
{
public float timer { get; set; } = 0;
public float deathtimer = 5;
public bool IsNeedDestroyInRecycle { get; set; } = false;
public Action<Transform> RecycleAction
{
get;
set;
}
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
timer += Time.deltaTime;
if (timer >= deathtimer)
{
timer = 0;
if (IsNeedDestroyInRecycle)
{
Destroy(gameObject);
}
else
{
//isNeedDestroyInRecycle = false;
RecycleAction?.Invoke(transform);
}
}
}
}