Пример #1
0
        public IEnumerable <KeyValuePair <AnimationTimelineTrigger, TriggerActionDiscrete> > GetAudioStartTriggerActions()
        {
            var mam = SuperController.singleton.motionAnimationMaster;
            // mam.triggers is protected all through the code so, find the actions through the JSON
            var mamJSON = mam.GetJSON();

            try
            {
                foreach (var triggerJSON in mamJSON["triggers"].AsArray.Cast <SimpleJSON.JSONClass>())
                {
                    var trigger = new AnimationTimelineTrigger();
                    trigger.RestoreFromJSON(triggerJSON);
                    foreach (var actionJSON in triggerJSON["startActions"].AsArray.Cast <SimpleJSON.JSONClass>())
                    {
                        var action = new TriggerActionDiscrete();
                        action.RestoreFromJSON(actionJSON);

                        if (action.audioClip != null)
                        {
                            yield return(new KeyValuePair <AnimationTimelineTrigger, TriggerActionDiscrete>(trigger, action));
                        }
                    }
                }
            }
            finally { }
            yield break;
        }
 public DiscreteTriggerCommand(Atom defaultAtom, IPrefabManager prefabManager)
     : base(prefabManager)
 {
     _triggerActionDiscrete = trigger.CreateDiscreteActionStartInternal();
     if (_triggerActionDiscrete.receiverAtom == null)
     {
         _triggerActionDiscrete.receiverAtom = defaultAtom;
     }
     if (_triggerActionDiscrete.receiver == null)
     {
         var defaultStorableId = defaultAtom.GetStorableIDs().FirstOrDefault(s => s.EndsWith("BindableActions"));
         if (defaultStorableId != null)
         {
             _triggerActionDiscrete.receiver = defaultAtom.GetStorableByID(defaultStorableId);
         }
     }
     _invokingJsonStorableAction = new JSONStorableAction("", Invoke);
 }