예제 #1
0
    public void StartMusic(PotTypes songType)
    {
        PlantSongVariation variation = songs.GetVariation(songType);

        currentClips   = variation.variations;
        theSource.clip = variation.startingClip;

        variationTempo.SetTempo(variation.startingClip.length);
        variationTempo.beat.AddListener(ClipSwap);

        // make it be triggered by the tempo
        globalTempo.beat.AddListener(DoBeat);
    }
예제 #2
0
 // Update is called once per frame
 void Update()
 {
     if (transform.parent != null && isPlanted == false)              //if it has a parent and it isnt planted
     {
         if (transform.parent.transform.gameObject.CompareTag("pot")) //if parent is a pot, play music
         {
             isPlanted = true;
             potType   = transform.parent.transform.gameObject.GetComponent <Pot>().potType;
             sounds.StartMusic(potType);
         }
     }
     else
     if (isPlanted == true && (transform.parent == null || transform.parent.gameObject.CompareTag("player"))) //if it was planted, but its parent isnt a pot(player or nothing) stop music
     {
         isPlanted = false;
         potType   = PotTypes.Empty;
         sounds.StopMusic();
     }
 }
예제 #3
0
    public PlantSongVariation GetVariation(PotTypes type)
    {
        if (type == PotTypes.Empty)
        {
            throw new System.Exception("Cannot play an empty pot type!");
        }

        switch (type)
        {
        case PotTypes.Busy:
            return(busyClips);

        case PotTypes.Medium:
            return(mediumClips);

        case PotTypes.Calm:
            return(calmClips);

        case PotTypes.Empty:
            break;
        }
        return(calmClips);
    }