void OnSoundPicked(string sfxId)
    {
        string lastSfxId = actor.GetSfxId();

        undoStack.PushUndoForActor(
            actor,
            $"Set sound effect for {actor.GetDisplayName()}",
            actor =>
        {
            actor.SetSfxId(sfxId);
            actor.ApplyPropertiesToClones();
        },
            actor =>
        {
            actor.SetSfxId(lastSfxId);
            actor.ApplyPropertiesToClones();
        });
    }
예제 #2
0
    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);
                    }
                }
            }
        }
    }