Beispiel #1
0
    private void SpawnExplosion(Vector2 mousePosition)
    {
        var explosion = m_explosionPool.Get();

        if (explosion == null)
        {
            Debug.LogWarning("Explosion pool is empty!");
            return;
        }

        // Track the explosion and spawn it at the mouse position.
        m_activeExplosions.Add(explosion);
        var position = Camera.main.ScreenToWorldPoint(mousePosition);

        explosion.Spawn(position);
        explosion.transform.parent = transform;
    }