public OcclusionCullingData(VirtualSerializedFile file) : this(file.CreateAssetInfo(ClassIDType.OcclusionCullingData)) { Name = nameof(OcclusionCullingData); file.AddAsset(this); }
public AnimatorStateTransition(VirtualSerializedFile file, AnimatorController controller, TransitionConstant transition) : base(file, ClassIDType.AnimatorStateTransition, controller, transition) { TransitionDuration = transition.TransitionDuration; TransitionOffset = transition.TransitionOffset; ExitTime = transition.GetExitTime(controller.File.Version); HasExitTime = transition.GetHasExitTime(controller.File.Version); HasFixedDuration = transition.GetHasFixedDuration(controller.File.Version);; InterruptionSource = transition.GetInterruptionSource(controller.File.Version); OrderedInterruption = transition.OrderedInterruption; CanTransitionToSelf = transition.CanTransitionToSelf; file.AddAsset(this); }
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); }
public BlendTree(VirtualSerializedFile file, AnimatorController controller, StateConstant state, int nodeIndex) : base(file.CreateAssetInfo(ClassIDType.BlendTree)) { BlendTreeNodeConstant node = state.GetBlendTree().NodeArray[nodeIndex].Instance; ObjectHideFlags = 1; Name = nameof(BlendTree); m_childs = new ChildMotion[node.ChildIndices.Count]; for (int i = 0; i < node.ChildIndices.Count; i++) { m_childs[i] = new ChildMotion(file, controller, state, nodeIndex, i); } BlendParameter = node.BlendEventID == uint.MaxValue ? string.Empty : controller.TOS[node.BlendEventID]; BlendParameterY = node.BlendEventYID == uint.MaxValue ? string.Empty : controller.TOS[node.BlendEventYID]; MinThreshold = node.GetMinThreshold(controller.File.Version); MaxThreshold = node.GetMaxThreshold(controller.File.Version); UseAutomaticThresholds = false; NormalizedBlendValues = node.BlendDirectData.Instance.NormalizedBlendValues; BlendType = node.BlendType; file.AddAsset(this); }
public AnimatorStateMachine(VirtualSerializedFile file, AnimatorController controller, int stateMachineIndex) : base(file.CreateAssetInfo(ClassIDType.AnimatorStateMachine)) { ObjectHideFlags = 1; LayerConstant layer = controller.Controller.GetLayerByStateMachineIndex(stateMachineIndex); Name = controller.TOS[layer.Binding]; StateMachineConstant stateMachine = controller.Controller.StateMachineArray[stateMachineIndex].Instance; int stateCount = stateMachine.StateConstantArray.Count; int stateMachineCount = 0; int count = stateCount + stateMachineCount; int side = (int)Math.Ceiling(Math.Sqrt(count)); List <AnimatorState> states = new List <AnimatorState>(); m_childStates = new ChildAnimatorState[stateCount]; for (int y = 0, stateIndex = 0; y < side && stateIndex < stateCount; y++) { for (int x = 0; x < side && stateIndex < stateCount; x++, stateIndex++) { Vector3f position = new Vector3f(x * StateOffset, y * StateOffset, 0.0f); AnimatorState state = new AnimatorState(file, controller, stateMachineIndex, stateIndex, position); ChildAnimatorState childState = new ChildAnimatorState(state, position); m_childStates[stateIndex] = childState; states.Add(state); } } m_childStateMachines = new ChildAnimatorStateMachine[stateMachineCount]; // set destination state for transitions here because all states has become valid only now for (int i = 0; i < stateMachine.StateConstantArray.Count; i++) { AnimatorState state = states[i]; StateConstant stateConstant = stateMachine.StateConstantArray[i].Instance; for (int j = 0; j < stateConstant.TransitionConstantArray.Count; j++) { long stateTransitionPath = state.Transitions[j].PathID; AnimatorStateTransition transition = (AnimatorStateTransition)file.GetAsset(stateTransitionPath); TransitionConstant transitionConstant = stateConstant.TransitionConstantArray[j].Instance; if (!transitionConstant.IsExit) { AnimatorState destState = states[transitionConstant.DestinationState]; transition.DstState = PPtr <AnimatorState> .CreateVirtualPointer(destState); } } } m_anyStateTransitions = new PPtr <AnimatorStateTransition> [stateMachine.AnyStateTransitionConstantArray.Count]; for (int i = 0; i < stateMachine.AnyStateTransitionConstantArray.Count; i++) { TransitionConstant transitionConstant = stateMachine.AnyStateTransitionConstantArray[i].Instance; AnimatorStateTransition transition = new AnimatorStateTransition(file, controller, transitionConstant, states); m_anyStateTransitions[i] = PPtr <AnimatorStateTransition> .CreateVirtualPointer(transition); } m_entryTransitions = stateMachine.GetEntryTransitions(file, controller, layer.Binding, states); m_stateMachineBehaviours = new PPtr <MonoBehaviour> [0]; AnyStatePosition = new Vector3f(0.0f, -StateOffset, 0.0f); EntryPosition = new Vector3f(StateOffset, -StateOffset, 0.0f); ExitPosition = new Vector3f(2.0f * StateOffset, -StateOffset, 0.0f); ParentStateMachinePosition = new Vector3f(0.0f, -2.0f * StateOffset, 0.0f); DefaultState = ChildStates.Count > 0 ? ChildStates[stateMachine.DefaultState].State : default; file.AddAsset(this); }
public AnimatorTransition(VirtualSerializedFile file, AnimatorController controller, SelectorTransitionConstant transition) : base(file, ClassIDType.AnimatorTransition, controller, transition) { file.AddAsset(this); }