Exemplo n.º 1
0
    public void OnTriggerEnter()
    {
        if (CurrentRespawn != this) // Make sure we're not respawning or re-activing an already active point
        {
            // Turn the old respawn off
            if (CurrentRespawn)
            {
                CurrentRespawn.SetInactive();
            }
            else
            {
                Debug.LogWarning("No intial respawn point set for this level.");
            }

            // Play the "Activated" one-shot sound effect
            if (SFXPlayerActivate)
            {
                AudioSource.PlayClipAtPoint(SFXPlayerActivate, transform.position, SFXVolume);
            }

            // Set the current respawn point to this one
            CurrentRespawn = this;

            SetActive();
        }
    }