Esempio n. 1
0
 protected override void Awake()
 {
     base.Awake();
     heart.enabled = false;
     if (gruntClips == null)
     {
         AudioList theList = (Resources.Load("Grunts") as AudioList);
         gruntClips   = theList.clips;
         gruntIndices = new int[gruntClips.Length];
         for (int i = 0; i < gruntIndices.Length; i++)
         {
             gruntIndices[i] = i;
         }
         PieceSpawner.SortInPlaceRandom(gruntIndices);
     }
     if (scoreClips == null)
     {
         AudioList theList = (Resources.Load("ScoreSounds") as AudioList);
         scoreClips   = theList.clips;
         scoreIndices = new int[scoreClips.Length];
         for (int i = 0; i < scoreIndices.Length; i++)
         {
             scoreIndices[i] = i;
         }
         PieceSpawner.SortInPlaceRandom(scoreIndices);
     }
     sleepCountdown.fillAmount = 0;
 }
Esempio n. 2
0
    private static AudioClip GetNextScoreClip()
    {
        int index = scoreIndices[currentScoreIndex];

        currentScoreIndex++;
        if (currentScoreIndex >= scoreIndices.Length)
        {
            currentScoreIndex = 0;
            PieceSpawner.SortInPlaceRandom(scoreIndices);
        }
        return(scoreClips[index]);
    }
Esempio n. 3
0
    private static AudioClip GetNextGruntClip()
    {
        int index = gruntIndices[currentGruntIndex];

        currentGruntIndex++;
        if (currentGruntIndex >= gruntIndices.Length)
        {
            currentGruntIndex = 0;
            PieceSpawner.SortInPlaceRandom(gruntIndices);
        }
        return(gruntClips[index]);
    }