void OnParticlePicked(string pfxId) { string lastPfxId = actor.GetPfxId(); undoStack.PushUndoForActor( actor, $"Set particle effect for {actor.GetDisplayName()}", actor => { actor.SetPfxId(pfxId); actor.ApplyPropertiesToClones(); }, actor => { actor.SetPfxId(lastPfxId); actor.ApplyPropertiesToClones(); }); }
static IEnumerable <string> GetUsedSojoIds(VoosActor actor) { string pfxId = actor.GetPfxId(); string sfxId = actor.GetSfxId(); if (!pfxId.IsNullOrEmpty()) { yield return(pfxId); } if (!sfxId.IsNullOrEmpty()) { yield return(sfxId); } var brain = new ActorBehaviorsEditor(actor.GetName(), actor.GetEngine(), null); foreach (var beh in brain.GetAssignedBehaviors()) { foreach (var prop in beh.GetProperties()) { if (prop.propType == BehaviorProperties.PropType.Image || prop.propType == BehaviorProperties.PropType.ParticleEffect || prop.propType == BehaviorProperties.PropType.Prefab || prop.propType == BehaviorProperties.PropType.Sound) { if (prop.propType == BehaviorProperties.PropType.Prefab) { throw new System.Exception("Sorry, exporting an actor with prefab ref is not supported yet."); } // Yes, we should crash if the string cast fails. string sojoId = (string)prop.data; if (!sojoId.IsNullOrEmpty()) { yield return(sojoId); } } } } }