private AnimatorState(AssetInfo assetInfo, AnimatorController controller, int stateMachineIndex, int stateIndex, Vector3f position) : base(assetInfo, HideFlags.HideInHierarchy) { VirtualSerializedFile virtualFile = (VirtualSerializedFile)assetInfo.File; IReadOnlyDictionary <uint, string> TOS = controller.TOS; if (!TOS.ContainsKey(0)) { Dictionary <uint, string> tos = new Dictionary <uint, string>() { { 0, string.Empty } }; tos.AddRange(controller.TOS); TOS = tos; } StateMachineConstant stateMachine = controller.Controller.StateMachineArray[stateMachineIndex].Instance; StateConstant state = stateMachine.StateConstantArray[stateIndex].Instance; Name = TOS[state.NameID]; Speed = state.Speed; CycleOffset = state.CycleOffset; // skip Transitions because not all state exists at this moment // exclude StateMachine's behaviours int layerIndex = controller.Controller.GetLayerIndexByStateMachineIndex(stateMachineIndex); PPtr <MonoBehaviour>[] machineBehaviours = controller.GetStateBehaviours(layerIndex); PPtr <MonoBehaviour>[] stateBehaviours = controller.GetStateBehaviours(stateMachineIndex, stateIndex); List <PPtr <MonoBehaviour> > behaviours = new List <PPtr <MonoBehaviour> >(stateBehaviours.Length); foreach (PPtr <MonoBehaviour> ptr in stateBehaviours) { #warning TEMP: remove comment when AnimatorStateMachine's child StateMachines has been implemented //if (!machineBehaviours.Contains(ptr)) { behaviours.Add(ptr); } } StateMachineBehaviours = behaviours.ToArray(); Position = position; IKOnFeet = state.IKOnFeet; WriteDefaultValues = state.GetWriteDefaultValues(controller.File.Version); Mirror = state.Mirror; SpeedParameterActive = state.SpeedParamID > 0; MirrorParameterActive = state.MirrorParamID > 0; CycleOffsetParameterActive = state.CycleOffsetParamID > 0; TimeParameterActive = state.TimeParamID > 0; Motion = state.CreateMotion(virtualFile, controller, 0); Tag = TOS[state.TagID]; SpeedParameter = TOS[state.SpeedParamID]; MirrorParameter = TOS[state.MirrorParamID]; CycleOffsetParameter = TOS[state.CycleOffsetParamID]; TimeParameter = TOS[state.TimeParamID]; }
private AnimatorState(AssetInfo assetInfo, AnimatorController controller, int stateMachineIndex, int stateIndex, Vector3f position) : base(assetInfo, 1) { VirtualSerializedFile virtualFile = (VirtualSerializedFile)assetInfo.File; IReadOnlyDictionary <uint, string> TOS = controller.TOS; if (!TOS.ContainsKey(0)) { Dictionary <uint, string> tos = new Dictionary <uint, string>(); tos.Add(0, string.Empty); tos.AddRange(controller.TOS); TOS = tos; } StateMachineConstant stateMachine = controller.Controller.StateMachineArray[stateMachineIndex].Instance; StateConstant state = stateMachine.StateConstantArray[stateIndex].Instance; Name = TOS[state.NameID]; Speed = state.Speed; CycleOffset = state.CycleOffset; m_transitions = new PPtr <AnimatorStateTransition> [state.TransitionConstantArray.Count]; for (int i = 0; i < state.TransitionConstantArray.Count; i++) { TransitionConstant transitionConstant = state.TransitionConstantArray[i].Instance; AnimatorStateTransition transition = AnimatorStateTransition.CreateVirtualInstance(virtualFile, controller, transitionConstant); m_transitions[i] = transition.File.CreatePPtr(transition); } m_stateMachineBehaviours = controller.GetStateBeahviours(stateMachineIndex, stateIndex); Position = position; IKOnFeet = state.IKOnFeet; WriteDefaultValues = state.GetWriteDefaultValues(controller.File.Version); Mirror = state.Mirror; SpeedParameterActive = state.SpeedParamID > 0; MirrorParameterActive = state.MirrorParamID > 0; CycleOffsetParameterActive = state.CycleOffsetParamID > 0; TimeParameterActive = state.TimeParamID > 0; Motion = state.CreateMotion(virtualFile, controller, 0); Tag = TOS[state.TagID]; SpeedParameter = TOS[state.SpeedParamID]; MirrorParameter = TOS[state.MirrorParamID]; CycleOffsetParameter = TOS[state.CycleOffsetParamID]; TimeParameter = TOS[state.TimeParamID]; }
private AnimatorState(AssetInfo assetInfo, AnimatorController controller, int stateMachineIndex, int stateIndex, Vector3f position) : base(assetInfo, HideFlags.HideInHierarchy) { VirtualSerializedFile virtualFile = (VirtualSerializedFile)assetInfo.File; IReadOnlyDictionary <uint, string> TOS = controller.TOS; if (!TOS.ContainsKey(0)) { Dictionary <uint, string> tos = new Dictionary <uint, string>(); tos.Add(0, string.Empty); tos.AddRange(controller.TOS); TOS = tos; } StateMachineConstant stateMachine = controller.Controller.StateMachineArray[stateMachineIndex].Instance; StateConstant state = stateMachine.StateConstantArray[stateIndex].Instance; Name = TOS[state.NameID]; Speed = state.Speed; CycleOffset = state.CycleOffset; // skip Transitions because not all state exists right now m_stateMachineBehaviours = controller.GetStateBeahviours(stateMachineIndex, stateIndex); Position = position; IKOnFeet = state.IKOnFeet; WriteDefaultValues = state.GetWriteDefaultValues(controller.File.Version); Mirror = state.Mirror; SpeedParameterActive = state.SpeedParamID > 0; MirrorParameterActive = state.MirrorParamID > 0; CycleOffsetParameterActive = state.CycleOffsetParamID > 0; TimeParameterActive = state.TimeParamID > 0; Motion = state.CreateMotion(virtualFile, controller, 0); Tag = TOS[state.TagID]; SpeedParameter = TOS[state.SpeedParamID]; MirrorParameter = TOS[state.MirrorParamID]; CycleOffsetParameter = TOS[state.CycleOffsetParamID]; TimeParameter = TOS[state.TimeParamID]; }
public AnimatorState(VirtualSerializedFile file, AnimatorController controller, int stateMachineIndex, int stateIndex, Vector3f position) : base(file.CreateAssetInfo(ClassIDType.AnimatorState)) { ObjectHideFlags = 1; IReadOnlyDictionary <uint, string> TOS = controller.TOS; StateMachineConstant stateMachine = controller.Controller.StateMachineArray[stateMachineIndex].Instance; StateConstant state = stateMachine.StateConstantArray[stateIndex].Instance; Name = TOS[state.NameID]; Speed = state.Speed; CycleOffset = state.CycleOffset; m_transitions = new PPtr <AnimatorStateTransition> [state.TransitionConstantArray.Count]; for (int i = 0; i < state.TransitionConstantArray.Count; i++) { TransitionConstant transitionConstant = state.TransitionConstantArray[i].Instance; AnimatorStateTransition transition = new AnimatorStateTransition(file, controller, transitionConstant); m_transitions[i] = PPtr <AnimatorStateTransition> .CreateVirtualPointer(transition); } m_stateMachineBehaviours = controller.GetStateBeahviours(stateMachineIndex, stateIndex); Position = position; IKOnFeet = state.IKOnFeet; WriteDefaultValues = state.GetWriteDefaultValues(controller.File.Version); Mirror = state.Mirror; SpeedParameterActive = state.SpeedParamID > 0; MirrorParameterActive = state.MirrorParamID > 0; CycleOffsetParameterActive = state.CycleOffsetParamID > 0; TimeParameterActive = state.TimeParamID > 0; Motion = state.CreateMotion(file, controller, 0); Tag = TOS[state.TagID]; SpeedParameter = TOS[state.SpeedParamID]; MirrorParameter = TOS[state.MirrorParamID]; CycleOffsetParameter = TOS[state.CycleOffsetParamID]; TimeParameter = TOS[state.TimeParamID]; file.AddAsset(this); }