Files
Cielonos/Assets/Scripts/MainGame/Base/FunctionalAnimation/Payloads/SpawnVFX.cs
SoulliesOfficial 7bc1e1722c 爆更
2026-06-05 04:21:00 -04:00

39 lines
1.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using Cielonos.MainGame.Interactions;
using SLSUtilities.FunctionalAnimation;
using UnityEngine;
namespace Cielonos.MainGame.FunctionalAnimation
{
[Serializable]
public class SpawnVFX : FuncAnimPayloadBase
{
public string vfxKey = "VFXKey";
public override void Invoke()
{
if (mute) return;
VFXData vfxData = null;
if (Character != null) // 战斗角色分支
{
vfxData = Character.vfxData;
}
else if (Executor is NpcBase npc) // NPC 分支
{
vfxData = npc.vfxData;
}
if (vfxData != null)
{
//如果非战斗角色Character就是null通过 Executor 来获取 Transform 以正确生成 VFX
VFXObject vfxObject = vfxData.SpawnVFX(vfxKey, Character, Executor.Transform).GetComponent<VFXObject>();
if (vfxObject != null && Character != null)
{
vfxObject.SetCreator(Character);
}
}
}
}
}