private Coin PopFromPool() { Coin c = pool[0]; pool.Remove(c); c.Activate(duration); return(c); }
public Coin RequestObject() { if (pool.Count == 0) { Coin c = Instantiate(coin, transform).GetComponent <Coin>(); c.Activate(duration); return(c); } else { return(PopFromPool()); } }
/// <summary> /// Sets the coin instance /// </summary> /// <param name="coinInstance"></param> public virtual void SetCoinInstance(Coin coinInstance) { m_coinInstance = coinInstance; if (m_coinInstance != null) { m_coinInstance.transform.position = GetRandomLandingPos(); m_coinInstance.transform.parent = transform; m_coinInstance.gameObject.SetActive(true); m_coinInstance.SetOnCoinGetDelegate(RemoveCoinInstance); m_coinInstance.Activate(); } }