static void ReleaseComponentPair(StateComponentPair pair) { if (pair != null) { pairCache.Add(pair); } }
static void ReleaseComponentPair(StateComponentPair pair) { if (pair != null) { pair.applyTo = null; pair.component = null; pair.state = null; pair.lastRefClip = null; pairCache.Add(pair); } }
internal void CalcWeight() { attachStateComponent.Sort(StateComponentPairComparerByLayer.comparer); int lastLayer = attachStateComponent[0].state.layer; int lastLayerStart = 0; layerGroupCount = 0; int i = 0, e = 0; for (i = 0, e = attachStateComponent.Count; i < e; i++) { StateComponentPair pair = attachStateComponent[i]; if (lastLayer != pair.state.layer) { int idx = layerGroupCount++; layerGroup[idx].startIndex = lastLayerStart; layerGroup[idx].length = i - lastLayerStart; layerGroup[idx].layer = lastLayer; lastLayerStart = i; lastLayer = pair.state.layer; } } if (i - lastLayerStart > 0) { int idx = layerGroupCount++; layerGroup[idx].startIndex = lastLayerStart; layerGroup[idx].length = i - lastLayerStart; layerGroup[idx].layer = lastLayer; } float totalWeight = 1f; bool weightPassNext = layerGroupCount > 1; //string str = layerGroupCount.ToString() + "\n"; for (i = 0; i < layerGroupCount; i++) { //str += "length:" + layerGroup[i].length + ", layer:" + layerGroup[i].layer.ToString() + "\n"; totalWeight = CalcGroupWeight(layerGroup[i].startIndex, layerGroup[i].length, totalWeight, weightPassNext, layerGroup[i].layer); } //Debug.Log(str); }
static StateComponentPair CreateComponentPair() { if (pairCache.Count == 0) { for (int i = 0; i < 32; i++) { pairCache.Add(new StateComponentPair()); } } int idx = pairCache.Count - 1; StateComponentPair ret = pairCache[idx]; pairCache.RemoveAt(idx); return(ret); }
internal void CalcWeight() { int lastLayer = attachStateComponent[0].state.layer; int lastLayerStart = 0; layerGroupCount = 0; int i = 0, e = 0; for (i = 0, e = attachStateComponent.Count; i < e; i++) { StateComponentPair pair = attachStateComponent[i]; if (lastLayer != pair.state.layer) { int idx = layerGroupCount++; layerGroup[idx].startIndex = lastLayerStart; layerGroup[idx].length = i - lastLayerStart; layerGroup[idx].layer = lastLayer; lastLayerStart = i; lastLayer = pair.state.layer; } } if (i - lastLayerStart > 0) { int idx = layerGroupCount++; layerGroup[idx].startIndex = lastLayerStart; layerGroup[idx].length = i - lastLayerStart; } float totalWeight = 1f; bool weightPassNext = layerGroupCount > 1; for (i = 0; i < layerGroupCount; i++) { totalWeight = CalcGroupWeight(layerGroup[i].startIndex, layerGroup[i].length, totalWeight, weightPassNext, layerGroup[i].layer); } }