コード例 #1
0
    public void PlayAudio(AudioType audioType)
    {
        RandomAudioClip audioPlayer = ReturnMatchingAudio(audioType);

        if (audioPlayer == null)
        {
            return;
        }

        audioPlayer.PlayRandomAudioClip();
    }
コード例 #2
0
    /// <summary>
    /// Escalate the monster to a new danger level.
    /// </summary>
    public void Escalate()
    {
        _angrySound.PlayRandomAudioClip();

        UpdateEscalation(true);

        Debug.Log(string.Format("Monster escalates! It is now at level {0}.", MonsterEscalationLevel), this);

        if ((int)MonsterEscalationLevel >= Enum.GetNames(typeof(EscalationLevel)).Length)
        {
            LoseGame();
        }
    }
コード例 #3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag(Tags.FOOD))
     {
         if (currentFoodCount < foodCount)
         {
             Debug.Log("The monster ate food.", this);
             eatingSounds.PlayRandomAudioClip();
             Destroy(other.gameObject);
             monsterScript.RegisterAction(ActionType.DragAndDrop, HotSpotLocation.Teeth);
         }
         if (currentFoodCount >= foodCount)
         {
             minigameManager.CompleteCurrentMinigame();
         }
         currentFoodCount++;
     }
 }