备份CatanBuilding瘦身独立工程
This commit is contained in:
65
Assets/Scripts/EventWashing/Assistants/SplashAnimation.cs
Normal file
65
Assets/Scripts/EventWashing/Assistants/SplashAnimation.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user