Exemple #1
0
    private Coin PopFromPool()
    {
        Coin c = pool[0];

        pool.Remove(c);

        c.Activate(duration);

        return(c);
    }
Exemple #2
0
 public Coin RequestObject()
 {
     if (pool.Count == 0)
     {
         Coin c = Instantiate(coin, transform).GetComponent <Coin>();
         c.Activate(duration);
         return(c);
     }
     else
     {
         return(PopFromPool());
     }
 }
Exemple #3
0
    /// <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();
        }
    }