
using PathologicalGames;
public class UI_MightyKnight_Main : MonoBehaviour
{
private SpawnPool _sp_KillMonsterPool;
void Start ()
{
_sp_KillMonsterPool = PoolManager.Pools["MonsterDieGetGold"];
}
public void KillMonsterGetGold( Transform tf, float getGold)
{
Transform temp_item = _sp_KillMonsterPool.Spawn("Pool_MonsterDieGetGold");
temp_item.localPosition = tf.localPosition;
temp_item.GetComponent<MonsterDieGetGold>().Initial();
}
}
------------------------------------------
using PathologicalGames;
public class MonsterDieGetGold : MonoBehaviour {
Transform trans_GameGoldDisplay;
private SpawnPool _sp_KillMonsterPool;
public void Initial()
{
_sp_KillMonsterPool = PoolManager.Pools["MonsterDieGetGold"];
trans_GameGoldDisplay = GameObject.Find("GameGoldDisplay").transform;
this.transform.DOLocalMove(trans_GameGoldDisplay.localPosition, 1).OnComplete(() =>
{
if (_sp_KillMonsterPool.IsSpawned(this.transform))
{
_sp_KillMonsterPool.Despawn(this.transform);
}
});
}
}