コード例 #1
0
 private static void CollectEvents(List <MecanimEvent> allEvents, Dictionary <int, Dictionary <int, Dictionary <int, List <MecanimEvent> > > > contextLoadedData, Animator animator, int animatorControllerId, int layer, int nameHash, int tagHash, float normalizedTimeStart, float normalizedTimeEnd, bool onlyCritical = false)
 {
     if (contextLoadedData.ContainsKey(animatorControllerId) && contextLoadedData[animatorControllerId].ContainsKey(layer) && contextLoadedData[animatorControllerId][layer].ContainsKey(nameHash))
     {
         List <MecanimEvent> list = contextLoadedData[animatorControllerId][layer][nameHash];
         for (int i = 0; i < list.Count; i++)
         {
             MecanimEvent mecanimEvent = list[i];
             if (mecanimEvent.isEnable)
             {
                 if (mecanimEvent.normalizedTime >= normalizedTimeStart && mecanimEvent.normalizedTime < normalizedTimeEnd && mecanimEvent.condition.Test(animator))
                 {
                     if (!onlyCritical || mecanimEvent.critical)
                     {
                         MecanimEvent pooledEvent = MecanimEventManager.GetPooledEvent();
                         pooledEvent.Copy(mecanimEvent);
                         EventContext context = pooledEvent.GetContext();
                         context.controllerId = animatorControllerId;
                         context.layer        = layer;
                         context.stateHash    = nameHash;
                         context.tagHash      = tagHash;
                         pooledEvent.SetContext(context);
                         allEvents.Add(pooledEvent);
                     }
                 }
             }
         }
         return;
     }
 }
コード例 #2
0
 public static void PoolEvent(MecanimEvent me)
 {
     me.Reset();
     me.GetContext().Reset();
     MecanimEventManager.pooledEvents.Push(me);
 }