Beispiel #1
0
 public PPtr <MonoBehaviour>[] GetStateBeahviours(int stateMachineIndex, int stateIndex)
 {
     if (IsReadStateMachineBehaviourVectorDescription(File.Version))
     {
         int layerIndex = Controller.GetLayerIndexByStateMachineIndex(stateMachineIndex);
         StateMachineConstant stateMachine = Controller.StateMachineArray[stateMachineIndex].Instance;
         StateConstant        state        = stateMachine.StateConstantArray[stateIndex].Instance;
         uint stateID = state.GetID(File.Version);
         foreach (KeyValuePair <StateKey, StateRange> pair in StateMachineBehaviourVectorDescription.StateMachineBehaviourRanges)
         {
             StateKey key = pair.Key;
             if (key.LayerIndex == layerIndex && key.StateID == stateID)
             {
                 StateRange             range = pair.Value;
                 PPtr <MonoBehaviour>[] stateMachineBehaviours = new PPtr <MonoBehaviour> [range.Count];
                 for (int i = 0; i < range.Count; i++)
                 {
                     int index = (int)StateMachineBehaviourVectorDescription.StateMachineBehaviourIndices[range.StartIndex + i];
                     stateMachineBehaviours[i] = StateMachineBehaviours[index];
                 }
                 return(stateMachineBehaviours);
             }
         }
     }
     return(new PPtr <MonoBehaviour> [0]);
 }
 public PPtr <MonoBehaviour>[] GetStateBehaviours(int stateMachineIndex, int stateIndex)
 {
     if (HasStateMachineBehaviourVectorDescription(File.Version))
     {
         int layerIndex = Controller.GetLayerIndexByStateMachineIndex(stateMachineIndex);
         StateMachineConstant stateMachine = Controller.StateMachineArray[stateMachineIndex].Instance;
         StateConstant        state        = stateMachine.StateConstantArray[stateIndex].Instance;
         uint     stateID = state.GetID(File.Version);
         StateKey key     = new StateKey(layerIndex, stateID);
         if (StateMachineBehaviourVectorDescription.StateMachineBehaviourRanges.TryGetValue(key, out StateRange range))
         {
             return(GetStateBehaviours(range));
         }
     }
     return(Array.Empty <PPtr <MonoBehaviour> >());
 }