本文整理汇总了C#中Animator.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.GetHashCode方法的具体用法?C# Animator.GetHashCode怎么用?C# Animator.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animator
的用法示例。
在下文中一共展示了Animator.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEvents
public static MecanimEvent[] GetEvents(Dictionary<int, Dictionary<int, Dictionary<int, List<MecanimEvent>>>> contextLoadedData,
Dictionary<int, Dictionary<int, AnimatorStateInfo>> contextLastStates,
int animatorControllerId, Animator animator)
{
List<MecanimEvent> allEvents = new List<MecanimEvent>();
int animatorHash = animator.GetHashCode();
if (!contextLastStates.ContainsKey(animatorHash))
contextLastStates[animatorHash] = new Dictionary<int, AnimatorStateInfo>();
int layerCount = animator.layerCount;
Dictionary<int, AnimatorStateInfo> lastLayerState = contextLastStates[animatorHash];
for (int layer = 0; layer < layerCount; layer++) {
if (!lastLayerState.ContainsKey(layer)) {
lastLayerState[layer] = new AnimatorStateInfo();
}
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(layer);
int lastLoop = (int)lastLayerState[layer].normalizedTime;
int currLoop = (int)stateInfo.normalizedTime;
float lastNormalizedTime = lastLayerState[layer].normalizedTime - lastLoop;
float currNormalizedTime = stateInfo.normalizedTime - currLoop;
if (lastLayerState[layer].fullPathHash == stateInfo.fullPathHash) {
if (stateInfo.loop == true) {
if (lastLoop == currLoop) {
allEvents.AddRange(CollectEvents(contextLoadedData, animator, animatorControllerId, layer, stateInfo.fullPathHash, stateInfo.tagHash, lastNormalizedTime, currNormalizedTime));
}
else {
allEvents.AddRange(CollectEvents(contextLoadedData, animator, animatorControllerId, layer, stateInfo.fullPathHash, stateInfo.tagHash, lastNormalizedTime, 1.00001f));
allEvents.AddRange(CollectEvents(contextLoadedData, animator, animatorControllerId, layer, stateInfo.fullPathHash, stateInfo.tagHash, 0.0f, currNormalizedTime));
}
}
else {
float start = Mathf.Clamp01(lastLayerState[layer].normalizedTime);
float end = Mathf.Clamp01(stateInfo.normalizedTime);
if (lastLoop == 0 && currLoop == 0) {
if (start != end)
allEvents.AddRange(CollectEvents(contextLoadedData, animator, animatorControllerId, layer, stateInfo.fullPathHash, stateInfo.tagHash, start, end));
}
else if (lastLoop == 0 && currLoop > 0) {
allEvents.AddRange(CollectEvents(contextLoadedData, animator, animatorControllerId, layer, lastLayerState[layer].fullPathHash, lastLayerState[layer].tagHash, start, 1.00001f));
}
else {
}
}
}
else {
allEvents.AddRange(CollectEvents(contextLoadedData, animator, animatorControllerId, layer, stateInfo.fullPathHash, stateInfo.tagHash, 0.0f, currNormalizedTime));
if (!lastLayerState[layer].loop) {
allEvents.AddRange(CollectEvents(contextLoadedData, animator, animatorControllerId, layer, lastLayerState[layer].fullPathHash, lastLayerState[layer].tagHash, lastNormalizedTime, 1.00001f, true));
}
}
lastLayerState[layer] = stateInfo;
}
return allEvents.ToArray();
}