Files
back_cantanBuilding/Assets/Scripts/EventWashing/Assistants/SplashAnimation.cs
2026-05-26 16:15:54 +08:00

66 lines
1.2 KiB
C#

using asap.core.common;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace game
{
public class SplashAnimation : MonoBehaviour, IPoolableObject
{
private IObjectPool pool;
private float m_Timer;
private bool m_IsTiming = false;
private void Update()
{
if (m_IsTiming == false) return;
m_Timer -= Time.deltaTime;
if (m_Timer <= 0)
{
ReturnPool();
m_Timer = 0f;
m_IsTiming = false;
}
}
public void SetTimer(float timer)
{
m_Timer = timer;
}
private void OnEnable()
{
m_IsTiming = true;
}
private void OnDisable()
{
m_IsTiming = false;
}
public void OnDespawn()
{
}
public void OnPoolCreate(IObjectPool objectPool)
{
pool = objectPool;
}
public void OnPoolDestroy()
{
pool = null;
}
public void OnSpawn()
{
}
public void ReturnPool()
{
pool?.DespawnObject(this);
}
}
}