Ejemplo n.º 1
0
 private void RemoveAnswerButton()
 {
     while (answerButtonObjects.Count > 0)
     {
         answerButtonPool.ReturnObject(answerButtonObjects[0]);
         answerButtonObjects.RemoveAt(0);
     }
 }
Ejemplo n.º 2
0
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            SpawnExplosion(new Vector2(Screen.width * 0.5f, Screen.height * 0.5f));
        }

        if (Input.GetMouseButtonDown(0))
        {
            SpawnExplosion(Input.mousePosition);
        }

        // When any explosions have finished, return them to the pool.
        for (var i = m_activeExplosions.Count - 1; i >= 0; i--)
        {
            var explosion = m_activeExplosions[i];
            if (!explosion.IsAlive)
            {
                m_activeExplosions.RemoveAt(i);
                m_explosionPool.ReturnObject(explosion.gameObject);
            }
        }
    }