46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
using System;
|
|
using Cielonos.MainGame.Characters.Inventory;
|
|
using Sirenix.OdinInspector;
|
|
using SLSUtilities.FunctionalAnimation;
|
|
using SLSUtilities.WwiseAssistance;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.FunctionalAnimation
|
|
{
|
|
[Serializable]
|
|
public class PlaySoundFX : FuncAnimPayloadBase
|
|
{
|
|
[WwiseEvent]
|
|
public uint soundID = AkUnitySoundEngine.AK_INVALID_PLAYING_ID;
|
|
[Tooltip("是否显示高级设置")]
|
|
public bool advancedSettings = false;
|
|
[ShowIf("advancedSettings")] public bool attachToBodyPart = false;
|
|
[ShowIf("@advancedSettings && attachToBodyPart")] public bool attachToMainBodyPart = true;
|
|
[ShowIf("@advancedSettings && attachToMainBodyPart")] public ViewObjectData.AttachBodyPartType mainBodyPart;
|
|
[ShowIf("@advancedSettings && !attachToMainBodyPart")] public string customBodyPart;
|
|
[ShowIf("advancedSettings")] public Vector3 positionOffset = Vector3.zero;
|
|
|
|
public override void Invoke()
|
|
{
|
|
if (!advancedSettings)
|
|
{
|
|
AudioManager.Post(soundID, character.centerPosition);
|
|
}
|
|
else
|
|
{
|
|
Vector3 postPosition = character.centerPosition;
|
|
|
|
if (attachToBodyPart)
|
|
{
|
|
Transform part = attachToMainBodyPart ?
|
|
character.bodyPartsSc.GetPart(mainBodyPart) :
|
|
character.bodyPartsSc.GetPart(customBodyPart);
|
|
postPosition = part != null ? part.position : character.centerPosition;
|
|
}
|
|
|
|
Vector3 finalPosition = postPosition + positionOffset;
|
|
AudioManager.Post(soundID, finalPosition);
|
|
}
|
|
}
|
|
}
|
|
} |