public ClipNode(ClipNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; PlaybackRate = nodeDesc.PlaybackRate; clipPlayer = new ClipPlayer(package.SkinningData); clipPlayer.StartClip(package.SkinningData.AnimationClips[nodeDesc.ClipName]); }
protected override void CreateAnimationPlayer(AnimationPackage animationPackage) { if (animationPackage.SkinningData != null) { SkinClipPlayer = new SkinClipPlayer(animationPackage.SkinningData); } GameResources.ActorManager.AnimationUpdateStep += AnimationUpdateHandler; }
public AnimationState(AnimationStateDescription stateDesc, AnimationPackage package) { Name = stateDesc.Name; MinDuration = TimeSpan.FromSeconds(stateDesc.MinDurationInSeconds); timeInState = TimeSpan.Zero; playbackRate = 1.0f; blendTree = AnimationNode.Create(package.NodeDescriptions[stateDesc.BlendTreeNodeName], package); }
public BinaryAdditiveBlendNode(BinaryAdditiveBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; targetPose = AnimationNode.Create(package.NodeDescriptions[nodeDesc.TargetNodeName], package); differencePose = AnimationNode.Create(package.NodeDescriptions[nodeDesc.DifferenceNodeName], package); playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public BinaryRateRampBlendNode(BinaryRateRampBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; rate1 = nodeDesc.Rate1; rate2 = nodeDesc.Rate2; child = AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeName], package); playbackRate = 1.0f; BlendFactor = nodeDesc.BlendFactor; }
public BinaryLerpBlendNode(BinaryLerpBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendFactor = nodeDesc.BlendFactor; playbackRate = nodeDesc.PlaybackRate; child1 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child1NodeName], package); child2 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child2NodeName], package); playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; // Make sure the child nodes are populated so this value can propagate down. }
public TernaryLerpBlendNode(TernaryLerpBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendPosition = nodeDesc.BlendPosition; Child1Position = nodeDesc.Child1NodePosition; Child2Position = nodeDesc.Child2NodePosition; Child3Position = nodeDesc.Child3NodePosition; child1 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child1NodeName], package); child2 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child2NodeName], package); child3 = AnimationNode.Create(package.NodeDescriptions[nodeDesc.Child3NodeName], package); playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public Continuous1DLerpBlendNode(Continuous1DLerpBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendPosition = nodeDesc.BlendPosition; ChildrenByPosition = new Dictionary<float, AnimationNode>(); for (int c = 0; c < nodeDesc.ChildNodeNames.Count; c++ ) { AnimationNode childNode = AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeNames[c]], package); ChildrenByPosition.Add(nodeDesc.ChildPositionsByName[nodeDesc.ChildNodeNames[c]], childNode); } playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public General1DPositionalBlendNode(General1DPositionalBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendPosition = nodeDesc.BlendPosition; children = new List<AnimationNode>(); Partition = nodeDesc.ChildRangesByName; SyncClipNodeName = nodeDesc.SyncClipNodeName; for (int c = 0; c < nodeDesc.ChildNodeNames.Count; c++) { children.Add(AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeNames[c]], package)); } playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public AnimationStateMachine(AnimationPackage package) { horizMovement = Vector2.Zero; mSkinningData = package.SkinningData; // Use the data in the AnimationPackage structure to create states to fill our list and build // a transition matrix. states = new Dictionary <string, AnimationState>(); foreach (AnimationStateDescription stateDesc in package.StateDescriptions) { AnimationState newState = new AnimationState(stateDesc, package); states.Add(newState.Name, newState); } transitions = new Dictionary <AnimationState, Dictionary <AnimationState, TransitionInfo> >(); foreach (KeyValuePair <string, AnimationState> currentStateKvp in states) { transitions.Add(currentStateKvp.Value, new Dictionary <AnimationState, TransitionInfo>()); foreach (KeyValuePair <string, AnimationState> nextStateKvp in states) { TransitionInfo bestFitTransition = null; foreach (TransitionInfo ti in package.Transitions) { // The items lower in the list are higher priority and will override previous matches. if (ti.IsMatch(currentStateKvp.Key, nextStateKvp.Key)) { bestFitTransition = ti; } } transitions[currentStateKvp.Value].Add(nextStateKvp.Value, bestFitTransition); } } CurrentState = states[package.InitialStateName]; desiredState = CurrentState; ActiveTransition = null; nextState = null; blendFromCancelledTransitionPose = false; ActiveControlEvents = AnimationControlEvents.None; }
public AnimationStateMachine(AnimationPackage package) { horizMovement = Vector2.Zero; mSkinningData = package.SkinningData; // Use the data in the AnimationPackage structure to create states to fill our list and build // a transition matrix. states = new Dictionary<string, AnimationState>(); foreach (AnimationStateDescription stateDesc in package.StateDescriptions) { AnimationState newState = new AnimationState(stateDesc, package); states.Add(newState.Name, newState); } transitions = new Dictionary<AnimationState, Dictionary<AnimationState, TransitionInfo>>(); foreach (KeyValuePair<string, AnimationState> currentStateKvp in states) { transitions.Add(currentStateKvp.Value, new Dictionary<AnimationState, TransitionInfo>()); foreach (KeyValuePair<string, AnimationState> nextStateKvp in states) { TransitionInfo bestFitTransition = null; foreach (TransitionInfo ti in package.Transitions) { // The items lower in the list are higher priority and will override previous matches. if (ti.IsMatch(currentStateKvp.Key, nextStateKvp.Key)) bestFitTransition = ti; } transitions[currentStateKvp.Value].Add(nextStateKvp.Value, bestFitTransition); } } CurrentState = states[package.InitialStateName]; desiredState = CurrentState; ActiveTransition = null; nextState = null; blendFromCancelledTransitionPose = false; ActiveControlEvents = AnimationControlEvents.None; }
public General2DPositionalBlendNode(General2DPositionalBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendPosition = nodeDesc.BlendPosition; Triangulation = new List<TernaryLerpBlendNode>(); foreach (string triNodeName in nodeDesc.TriangleNodeNames) { Triangulation.Add((TernaryLerpBlendNode)(AnimationNode.Create(package.NodeDescriptions[triNodeName], package))); } children = new AnimationNode[Triangulation.Count]; for (int c = 0; c < Triangulation.Count; c++) { children[c] = Triangulation[c]; } playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public static AnimationNode Create(AnimationNodeDescription animationNodeDescription, AnimationPackage package) { Type nodeType = Type.GetType(animationNodeDescription.RuntimeTypeName); object[] aniNodeCtorParams = new object[] { animationNodeDescription, package }; return(Activator.CreateInstance(nodeType, aniNodeCtorParams) as AnimationNode); }
public General1DPositionalBlendNode(General1DPositionalBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendPosition = nodeDesc.BlendPosition; children = new List <AnimationNode>(); Partition = nodeDesc.ChildRangesByName; SyncClipNodeName = nodeDesc.SyncClipNodeName; for (int c = 0; c < nodeDesc.ChildNodeNames.Count; c++) { children.Add(AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeNames[c]], package)); } playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public Continuous1DLerpBlendNode(Continuous1DLerpBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendPosition = nodeDesc.BlendPosition; ChildrenByPosition = new Dictionary <float, AnimationNode>(); for (int c = 0; c < nodeDesc.ChildNodeNames.Count; c++) { AnimationNode childNode = AnimationNode.Create(package.NodeDescriptions[nodeDesc.ChildNodeNames[c]], package); ChildrenByPosition.Add(nodeDesc.ChildPositionsByName[nodeDesc.ChildNodeNames[c]], childNode); } playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public General2DPositionalBlendNode(General2DPositionalBlendNodeDescription nodeDesc, AnimationPackage package) { Name = nodeDesc.Name; BlendPosition = nodeDesc.BlendPosition; Triangulation = new List <TernaryLerpBlendNode>(); foreach (string triNodeName in nodeDesc.TriangleNodeNames) { Triangulation.Add((TernaryLerpBlendNode)(AnimationNode.Create(package.NodeDescriptions[triNodeName], package))); } children = new AnimationNode[Triangulation.Count]; for (int c = 0; c < Triangulation.Count; c++) { children[c] = Triangulation[c]; } playbackRate = 1.0f; PlaybackRate = nodeDesc.PlaybackRate; }
public static AnimationNode Create(AnimationNodeDescription animationNodeDescription, AnimationPackage package) { Type nodeType = Type.GetType(animationNodeDescription.RuntimeTypeName); object[] aniNodeCtorParams = new object[] { animationNodeDescription, package }; return Activator.CreateInstance(nodeType, aniNodeCtorParams) as AnimationNode; }
protected override void CreateAnimationPlayer(AnimationPackage animationPackage) { AnimationStateMachine = new AnimationStateMachine(animationPackage); GameResources.ActorManager.AnimationUpdateStep += AnimationUpdateHandler; }
protected abstract void CreateAnimationPlayer(AnimationPackage animationPackage);