Files
fnl/Assets/Extensions/ProCamera2D/Runtime/3rd Party Plugins Support/PlayMakerActions/PC2DShakeConstantWithPreset.cs
2026-02-21 16:40:15 -08:00

30 lines
914 B
C#

#if PLAYMAKER
using Com.LuisPedroFonseca.ProCamera2D;
using HutongGames.PlayMaker;
using TooltipAttribute = HutongGames.PlayMaker.TooltipAttribute;
using UnityEngine;
[Tooltip("Enables a constant shake on the camera using a preset configured in the editor")]
public class PC2DShakeConstantWithPreset : FsmStateActionProCamera2DBase
{
[RequiredField]
[Tooltip("The camera with the ProCamera2D component, most probably the MainCamera")]
public FsmGameObject MainCamera;
[Tooltip("The name of the constant shake preset configured in the editor")]
public FsmString PresetName;
public override void OnEnter()
{
var shake = MainCamera.Value.GetComponent<ProCamera2DShake>();
if (shake == null)
Debug.LogError("The ProCamera2D component needs to have the Shake plugin enabled.");
if (ProCamera2D.Instance != null && shake != null)
shake.ConstantShake(PresetName.Value);
Finish();
}
}
#endif