|
Post by Ash Blue on Apr 28, 2017 4:49:23 GMT
I noticed there wasn't a way in PlayMaker to pass the shake object in instead of a string. As strings can be unreliable due to object name changes. Here is a simple PlayMaker script for shaking by object instead of string.
using Com.LuisPedroFonseca.ProCamera2D;
namespace HutongGames.PlayMaker.Actions.ProCamera2D { [ActionCategory("Pro Camera 2D")] [Tooltip("Trigger a Pro Camera 2D shake preset by object")] public class TriggerShakePreset : FsmStateAction { [Tooltip("Shake object to execute")] [RequiredField] [ObjectType(typeof(ShakePreset))] public FsmObject shake;
public override void Reset () { shake = null; }
public override void OnEnter () { if (shake.IsNone || shake == null) { Finish(); return; }
var cam = ProCamera2D.Instance; if (cam == null) { Finish(); return; }
var shakeCtrl = cam.GetComponent<ProCamera2DShake>(); if (shakeCtrl == null) { Finish(); return; }
shakeCtrl.Shake(shake.Value as ShakePreset); Finish(); } } }
|
|
|
Post by Luís Pedro Fonseca on Apr 28, 2017 8:35:44 GMT
Thanks! Can I include this too? I definitely need to do an update to the Playmaker actions as I'm probably missing a few like you've been noticing.
|
|
|
Post by Ash Blue on Apr 28, 2017 10:40:20 GMT
Of course, feel free to use. I've got some other ideas for a couple other custom actions I might end up writing. If I do end up writing them I'll dump them in separate threads ^_^
|
|