コード例 #1
0
 public void PlaySound()
 {
     if (randomSound != null)
     {
         randomSound.PlaySound();
     }
 }
コード例 #2
0
 public void HitCheckpoint()
 {
     if (currentCheckpoint == 0)
     {
         currentLaps--;
         if (currentLaps < 0 && !lose)
         {
             win = true;
         }
     }
     currentCheckpoint++;
     if (currentCheckpoint == checkpoints.Count)
     {
         currentCheckpoint = 0;
     }
     checkpoints[currentCheckpoint].Activate();
     currentTime += checkpointTime;
     startEndSounds.PlaySound();
 }
コード例 #3
0
    private void OnEnable()
    {
        if (particle != null)
        {
            particle.Play();
        }

        if (audioSource != null)
        {
            if (audioSource.isPlaying)
            {
                audioSource.Stop();
            }
            audioSource.Play();
        }

        if (soundPlayer != null)
        {
            soundPlayer.PlaySound();
        }
    }