public void PlaceExplosion(Vector3 position)
 {
     if (IsCloseToPlayer(position) && StartAnimation(position, explosions))
     {
         soundEffects.PlayOnExplode();
     }
 }
Ejemplo n.º 2
0
    /**
     * Finds an unused explosion and activates it
     */
    public void PlaceExplosion(Vector3 position)
    {
        for (int i = 0; i < explosions.Count; ++i)
        {
            if (!explosions[i].activeSelf)
            {
                position.z = explosionAnimation.transform.position.z;
                explosions[i].SetActive(true);
                explosions[i].transform.position = position;
                explosions[i].GetComponent <Animator>().enabled = true;
                soundEffects.PlayOnExplode();
                return;
            }
        }

        Debug.LogError("Could not find inactive explosion sprite to use");
    }