Files
valheim/Assets/_Valheim/Scripts/Pet/PetPlaySoundMachine.cs
2025-07-04 14:16:14 +08:00

23 lines
658 B
C#

using System.Collections;
using System.Collections.Generic;
using DarkTonic.MasterAudio;
using UnityEngine;
using Valheim;
public class PetPlaySoundMachine : StateMachineBehaviour
{
[SoundGroup] public string dieSound;
public bool isStop = true;
public bool isWait = false;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnStateEnter(animator, stateInfo, layerIndex);
if(isStop)
MasterAudio.StopAllSoundsOfTransform(animator.transform);
if(dieSound!="")
MasterAudio.PlaySound3DAtTransform(dieSound, animator.transform);
}
}