using System.Collections.Generic; using UnityEngine; [AddComponentMenu("Modifiers/Morph")] public class MegaMorph : MegaMorphBase { public bool UseLimit; public float Max; public float Min; public Vector3[] oPoints; public int[] mapping; public float importScale = 1f; public bool flipyz; public bool negx; [HideInInspector] public float tolerance = 0.0001f; public bool showmapping; public float mappingSize = 0.001f; public int mapStart; public int mapEnd; public Vector3[] dif; private static Vector3[] endpoint = new Vector3[4]; private static Vector3[] splinepoint = new Vector3[4]; private static Vector3[] temppoint = new Vector3[2]; private Vector3[] p1; private Vector3[] p2; private Vector3[] p3; private Vector3[] p4; public List pers = new List(4); [HideInInspector] public int compressedmem; [HideInInspector] public int compressedmem1; [HideInInspector] public int memuse; public bool animate; public float atime; public float animtime; public float looptime; public MegaRepeatMode repeatMode; public float speed = 1f; private static int framenum; public int[] nonMorphedVerts; public int[] morphedVerts; public int[] morphMappingFrom; public int[] morphMappingTo; public int[] nonMorphMappingFrom; public int[] nonMorphMappingTo; private Vector3[] _verts; private Vector3[] _sverts; private bool mtmorphed; private int[] setStart; private int[] setEnd; private int[] copyStart; private int[] copyEnd; public override string ModName() { return "Morph"; } public override string GetHelpURL() { return "?page_id=257"; } public void PS3Remap() { } public override bool ModLateUpdate(MegaModContext mc) { if (animate) { animtime += Time.deltaTime * speed; switch (repeatMode) { case MegaRepeatMode.Loop: animtime = Mathf.Repeat(animtime, looptime); break; case MegaRepeatMode.Clamp: animtime = Mathf.Clamp(animtime, 0f, looptime); break; } SetAnim(animtime); } if (dif == null) { dif = new Vector3[mc.mod.verts.Length]; } return Prepare(mc); } public override bool Prepare(MegaModContext mc) { if (chanBank != null && chanBank.Count > 0) { return true; } return false; } private int FindVert(Vector3 vert) { float num = Vector3.SqrMagnitude(oPoints[0] - vert); int result = 0; for (int i = 0; i < oPoints.Length; i++) { float num2 = Vector3.SqrMagnitude(oPoints[i] - vert); if (num2 < num) { num = num2; result = i; } } return result; } private void DoMapping(Mesh mesh) { mapping = new int[mesh.vertexCount]; for (int i = 0; i < mesh.vertexCount; i++) { Vector3 vert = mesh.vertices[i]; vert.x = 0f - vert.x; mapping[i] = FindVert(vert); } } public void DoMapping(Vector3[] verts) { mapping = new int[verts.Length]; for (int i = 0; i < verts.Length; i++) { mapping[i] = FindVert(verts[i]); } } private void SetVerts(int j, Vector3[] p) { switch (j) { case 0: p1 = p; break; case 1: p2 = p; break; case 2: p3 = p; break; case 3: p4 = p; break; } } private void SetVerts(MegaMorphChan chan, int j, Vector3[] p) { switch (j) { case 0: chan.p1 = p; break; case 1: chan.p2 = p; break; case 2: chan.p3 = p; break; case 3: chan.p4 = p; break; } } public override void Modify(MegaModifiers mc) { if (nonMorphedVerts != null && nonMorphedVerts.Length > 1) { ModifyCompressed(mc); return; } framenum++; mc.ChangeSourceVerts(); bool flag = true; bool flag2 = false; float min = 0f; float max = 100f; if (UseLimit) { min = Min; max = Max; } for (int i = 0; i < chanBank.Count; i++) { MegaMorphChan megaMorphChan = chanBank[i]; megaMorphChan.UpdatePercent(); float num = (UseLimit ? Mathf.Clamp(megaMorphChan.Percent, min, max) : ((!megaMorphChan.mUseLimit) ? Mathf.Clamp(megaMorphChan.Percent, 0f, 100f) : Mathf.Clamp(megaMorphChan.Percent, megaMorphChan.mSpinmin, megaMorphChan.mSpinmax))); if (num == 0f && (num != 0f || megaMorphChan.fChannelPercent == 0f)) { continue; } megaMorphChan.fChannelPercent = num; if (megaMorphChan.mTargetCache == null || megaMorphChan.mTargetCache.Count <= 0 || !megaMorphChan.mActiveOverride) { continue; } flag2 = true; if (megaMorphChan.mUseLimit) { } if (flag) { flag = false; for (int j = 0; j < oPoints.Length; j++) { dif[j] = oPoints[j]; } } if (megaMorphChan.mTargetCache.Count == 1) { for (int k = 0; k < oPoints.Length; k++) { Vector3 vector = megaMorphChan.mDeltas[k]; dif[k].x += vector.x * num; dif[k].y += vector.y * num; dif[k].z += vector.z * num; } continue; } int count = megaMorphChan.mTargetCache.Count; float num2 = num; int l; for (l = 1; l <= count && num2 >= megaMorphChan.GetTargetPercent(l - 2); l++) { } if (l > count) { l = count; } p4 = oPoints; if (l == 1) { p1 = oPoints; p2 = megaMorphChan.mTargetCache[0].points; p3 = megaMorphChan.mTargetCache[1].points; } else if (l == count) { int num3 = count - 1; for (int num4 = 2; num4 >= 0; num4--) { num3--; if (num3 == -2) { SetVerts(num4, oPoints); } else { SetVerts(num4, megaMorphChan.mTargetCache[num3 + 1].points); } } } else { int num5 = l; for (int num6 = 3; num6 >= 0; num6--) { num5--; if (num5 == -2) { SetVerts(num6, oPoints); } else { SetVerts(num6, megaMorphChan.mTargetCache[num5 + 1].points); } } } float targetPercent = megaMorphChan.GetTargetPercent(l - 3); float targetPercent2 = megaMorphChan.GetTargetPercent(l - 2); float num7 = num2 - targetPercent; float num8 = targetPercent2 - targetPercent; float u = num7 / num8; for (int m = 0; m < oPoints.Length; m++) { Vector3 vector2 = oPoints[m]; endpoint[0] = p1[m]; endpoint[1] = p2[m]; endpoint[2] = p3[m]; endpoint[3] = p4[m]; if (l == 1) { splinepoint[0] = endpoint[0]; splinepoint[3] = endpoint[1]; temppoint[1] = endpoint[2] - endpoint[0]; temppoint[0] = endpoint[1] - endpoint[0]; float sqrMagnitude = temppoint[1].sqrMagnitude; if (sqrMagnitude == 0f) { splinepoint[1] = endpoint[0]; splinepoint[2] = endpoint[1]; } else { splinepoint[2] = endpoint[1] - Vector3.Dot(temppoint[0], temppoint[1]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; splinepoint[1] = endpoint[0] + megaMorphChan.mCurvature * (splinepoint[2] - endpoint[0]); } } else if (l == count) { splinepoint[0] = endpoint[1]; splinepoint[3] = endpoint[2]; temppoint[1] = endpoint[2] - endpoint[0]; temppoint[0] = endpoint[1] - endpoint[2]; float sqrMagnitude = temppoint[1].sqrMagnitude; if (sqrMagnitude == 0f) { splinepoint[1] = endpoint[0]; splinepoint[2] = endpoint[1]; } else { splinepoint[1] = endpoint[1] - Vector3.Dot(temppoint[1], temppoint[0]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; splinepoint[2] = endpoint[2] + megaMorphChan.mCurvature * (splinepoint[1] - endpoint[2]); } } else { temppoint[1] = endpoint[2] - endpoint[0]; temppoint[0] = endpoint[1] - endpoint[0]; float sqrMagnitude = temppoint[1].sqrMagnitude; splinepoint[0] = endpoint[1]; splinepoint[3] = endpoint[2]; if (sqrMagnitude == 0f) { splinepoint[1] = endpoint[0]; } else { splinepoint[1] = endpoint[1] + Vector3.Dot(temppoint[0], temppoint[1]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; } temppoint[1] = endpoint[3] - endpoint[1]; temppoint[0] = endpoint[2] - endpoint[1]; sqrMagnitude = temppoint[1].sqrMagnitude; if (sqrMagnitude == 0f) { splinepoint[2] = endpoint[1]; } else { splinepoint[2] = endpoint[2] - Vector3.Dot(temppoint[0], temppoint[1]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; } } Vector3 b; MegaUtils.Bez3D(out b, ref splinepoint, u); dif[m].x += (b.x - vector2.x) * megaMorphChan.weight; dif[m].y += (b.y - vector2.y) * megaMorphChan.weight; dif[m].z += (b.z - vector2.z) * megaMorphChan.weight; } } if (flag2) { for (int n = 0; n < mapping.Length; n++) { sverts[n] = dif[mapping[n]]; } } else { for (int num9 = 0; num9 < verts.Length; num9++) { sverts[num9] = verts[num9]; } } } private bool Changed(int v, int c) { for (int i = 0; i < chanBank[c].mTargetCache.Count; i++) { if (!oPoints[v].Equals(chanBank[c].mTargetCache[i].points[v])) { return true; } } return false; } public void Compress() { if (oPoints == null) { return; } List list = new List(); int num = 0; for (int i = 0; i < chanBank.Count; i++) { list.Clear(); for (int j = 0; j < oPoints.Length; j++) { if (Changed(j, i)) { list.Add(j); } } num += list.Count; } Debug.Log("Compressed will only morph " + num + " points instead of " + oPoints.Length * chanBank.Count); compressedmem = num * 12; } public void ModifyCompressed(MegaModifiers mc) { framenum++; mc.ChangeSourceVerts(); bool flag = true; bool flag2 = false; for (int i = 0; i < chanBank.Count; i++) { MegaMorphChan megaMorphChan = chanBank[i]; megaMorphChan.UpdatePercent(); float num = ((!megaMorphChan.mUseLimit) ? Mathf.Clamp(megaMorphChan.Percent, 0f, 100f) : Mathf.Clamp(megaMorphChan.Percent, megaMorphChan.mSpinmin, megaMorphChan.mSpinmax)); if (num == 0f && (num != 0f || megaMorphChan.fChannelPercent == 0f)) { continue; } megaMorphChan.fChannelPercent = num; if (megaMorphChan.mTargetCache == null || megaMorphChan.mTargetCache.Count <= 0 || !megaMorphChan.mActiveOverride) { continue; } flag2 = true; if (megaMorphChan.mUseLimit) { } if (flag) { flag = false; for (int j = 0; j < morphedVerts.Length; j++) { int num2 = morphedVerts[j]; dif[num2] = oPoints[num2]; } } if (megaMorphChan.mTargetCache.Count == 1) { for (int k = 0; k < morphedVerts.Length; k++) { int num3 = morphedVerts[k]; Vector3 vector = megaMorphChan.mDeltas[num3]; dif[num3].x += vector.x * num; dif[num3].y += vector.y * num; dif[num3].z += vector.z * num; } continue; } int count = megaMorphChan.mTargetCache.Count; float num4 = num; int l; for (l = 1; l <= count && num4 >= megaMorphChan.GetTargetPercent(l - 2); l++) { } if (l > count) { l = count; } p4 = oPoints; if (l == 1) { p1 = oPoints; p2 = megaMorphChan.mTargetCache[0].points; p3 = megaMorphChan.mTargetCache[1].points; } else if (l == count) { int num5 = count - 1; for (int num6 = 2; num6 >= 0; num6--) { num5--; if (num5 == -2) { SetVerts(num6, oPoints); } else { SetVerts(num6, megaMorphChan.mTargetCache[num5 + 1].points); } } } else { int num7 = l; for (int num8 = 3; num8 >= 0; num8--) { num7--; if (num7 == -2) { SetVerts(num8, oPoints); } else { SetVerts(num8, megaMorphChan.mTargetCache[num7 + 1].points); } } } float targetPercent = megaMorphChan.GetTargetPercent(l - 3); float targetPercent2 = megaMorphChan.GetTargetPercent(l - 2); float num9 = num4 - targetPercent; float num10 = targetPercent2 - targetPercent; float u = num9 / num10; for (int m = 0; m < morphedVerts.Length; m++) { int num11 = morphedVerts[m]; Vector3 vector2 = oPoints[num11]; endpoint[0] = p1[num11]; endpoint[1] = p2[num11]; endpoint[2] = p3[num11]; endpoint[3] = p4[num11]; if (l == 1) { splinepoint[0] = endpoint[0]; splinepoint[3] = endpoint[1]; temppoint[1] = endpoint[2] - endpoint[0]; temppoint[0] = endpoint[1] - endpoint[0]; float sqrMagnitude = temppoint[1].sqrMagnitude; if (sqrMagnitude == 0f) { splinepoint[1] = endpoint[0]; splinepoint[2] = endpoint[1]; } else { splinepoint[2] = endpoint[1] - Vector3.Dot(temppoint[0], temppoint[1]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; splinepoint[1] = endpoint[0] + megaMorphChan.mCurvature * (splinepoint[2] - endpoint[0]); } } else if (l == count) { splinepoint[0] = endpoint[1]; splinepoint[3] = endpoint[2]; temppoint[1] = endpoint[2] - endpoint[0]; temppoint[0] = endpoint[1] - endpoint[2]; float sqrMagnitude = temppoint[1].sqrMagnitude; if (sqrMagnitude == 0f) { splinepoint[1] = endpoint[0]; splinepoint[2] = endpoint[1]; } else { splinepoint[1] = endpoint[1] - Vector3.Dot(temppoint[1], temppoint[0]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; splinepoint[2] = endpoint[2] + megaMorphChan.mCurvature * (splinepoint[1] - endpoint[2]); } } else { temppoint[1] = endpoint[2] - endpoint[0]; temppoint[0] = endpoint[1] - endpoint[0]; float sqrMagnitude = temppoint[1].sqrMagnitude; splinepoint[0] = endpoint[1]; splinepoint[3] = endpoint[2]; if (sqrMagnitude == 0f) { splinepoint[1] = endpoint[0]; } else { splinepoint[1] = endpoint[1] + Vector3.Dot(temppoint[0], temppoint[1]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; } temppoint[1] = endpoint[3] - endpoint[1]; temppoint[0] = endpoint[2] - endpoint[1]; sqrMagnitude = temppoint[1].sqrMagnitude; if (sqrMagnitude == 0f) { splinepoint[2] = endpoint[1]; } else { splinepoint[2] = endpoint[2] - Vector3.Dot(temppoint[0], temppoint[1]) * megaMorphChan.mCurvature / sqrMagnitude * temppoint[1]; } } Vector3 b; MegaUtils.Bez3D(out b, ref splinepoint, u); dif[num11].x += b.x - vector2.x; dif[num11].y += b.y - vector2.y; dif[num11].z += b.z - vector2.z; } } if (flag2) { for (int n = 0; n < morphMappingFrom.Length; n++) { sverts[morphMappingTo[n]] = dif[morphMappingFrom[n]]; } for (int num12 = 0; num12 < nonMorphMappingFrom.Length; num12++) { sverts[nonMorphMappingTo[num12]] = oPoints[nonMorphMappingFrom[num12]]; } } else { for (int num13 = 0; num13 < verts.Length; num13++) { sverts[num13] = verts[num13]; } } } [ContextMenu("Compress Morphs")] public void BuildCompress() { bool[] array = new bool[oPoints.Length]; int num = 0; for (int i = 0; i < chanBank.Count; i++) { for (int j = 0; j < oPoints.Length; j++) { if (Changed(j, i)) { array[j] = true; } } } for (int k = 0; k < array.Length; k++) { if (array[k]) { num++; } } morphedVerts = new int[num]; nonMorphedVerts = new int[oPoints.Length - num]; int num2 = 0; int num3 = 0; List list = new List(); List list2 = new List(); for (int l = 0; l < oPoints.Length; l++) { if (array[l]) { morphedVerts[num2++] = l; for (int m = 0; m < mapping.Length; m++) { if (mapping[m] == l) { list.Add(l); list2.Add(m); } } } else { nonMorphedVerts[num3++] = l; } } morphMappingFrom = list.ToArray(); morphMappingTo = list2.ToArray(); list.Clear(); list2.Clear(); for (int n = 0; n < oPoints.Length; n++) { if (array[n]) { continue; } for (int num4 = 0; num4 < mapping.Length; num4++) { if (mapping[num4] == n) { list.Add(n); list2.Add(num4); } } } nonMorphMappingFrom = list.ToArray(); nonMorphMappingTo = list2.ToArray(); compressedmem = morphedVerts.Length * chanBank.Count * 12; } public override void PrepareMT(MegaModifiers mc, int cores) { PrepareForMT(mc, cores); } public override void DoWork(MegaModifiers mc, int index, int start, int end, int cores) { ModifyCompressedMT(mc, index, cores); } public void PrepareForMT(MegaModifiers mc, int cores) { if (setStart == null) { BuildMorphVertInfo(cores); } mtmorphed = false; for (int i = 0; i < chanBank.Count; i++) { MegaMorphChan megaMorphChan = chanBank[i]; megaMorphChan.UpdatePercent(); float num = ((!megaMorphChan.mUseLimit) ? Mathf.Clamp(megaMorphChan.Percent, 0f, 100f) : Mathf.Clamp(megaMorphChan.Percent, megaMorphChan.mSpinmin, megaMorphChan.mSpinmax)); if (num == 0f && (num != 0f || megaMorphChan.fChannelPercent == 0f)) { continue; } megaMorphChan.fChannelPercent = num; if (megaMorphChan.mTargetCache == null || megaMorphChan.mTargetCache.Count <= 0 || !megaMorphChan.mActiveOverride) { continue; } mtmorphed = true; if (megaMorphChan.mTargetCache.Count <= 1) { continue; } int count = megaMorphChan.mTargetCache.Count; megaMorphChan.fProgression = megaMorphChan.fChannelPercent; megaMorphChan.segment = 1; while (megaMorphChan.segment <= count && megaMorphChan.fProgression >= megaMorphChan.GetTargetPercent(megaMorphChan.segment - 2)) { megaMorphChan.segment++; } if (megaMorphChan.segment > count) { megaMorphChan.segment = count; } megaMorphChan.p4 = oPoints; if (megaMorphChan.segment == 1) { megaMorphChan.p1 = oPoints; megaMorphChan.p2 = megaMorphChan.mTargetCache[0].points; megaMorphChan.p3 = megaMorphChan.mTargetCache[1].points; continue; } if (megaMorphChan.segment == count) { int num2 = count - 1; for (int num3 = 2; num3 >= 0; num3--) { num2--; if (num2 == -2) { SetVerts(megaMorphChan, num3, oPoints); } else { SetVerts(megaMorphChan, num3, megaMorphChan.mTargetCache[num2 + 1].points); } } continue; } int num4 = megaMorphChan.segment; for (int num5 = 3; num5 >= 0; num5--) { num4--; if (num4 == -2) { SetVerts(megaMorphChan, num5, oPoints); } else { SetVerts(megaMorphChan, num5, megaMorphChan.mTargetCache[num4 + 1].points); } } } if (!mtmorphed) { for (int j = 0; j < verts.Length; j++) { sverts[j] = verts[j]; } return; } for (int k = 0; k < morphedVerts.Length; k++) { int num6 = morphedVerts[k]; dif[num6] = oPoints[num6]; } } public void ModifyCompressedMT(MegaModifiers mc, int tindex, int cores) { if (!mtmorphed) { return; } int num = morphedVerts.Length / cores; int num2 = tindex * num; int num3 = num2 + num; if (tindex == cores - 1) { num3 = morphedVerts.Length; } framenum++; Vector3[] array = new Vector3[4]; Vector3[] p = new Vector3[4]; Vector3[] array2 = new Vector3[2]; for (int i = 0; i < chanBank.Count; i++) { MegaMorphChan megaMorphChan = chanBank[i]; if (megaMorphChan.fChannelPercent == 0f || megaMorphChan.mTargetCache == null || megaMorphChan.mTargetCache.Count <= 0 || !megaMorphChan.mActiveOverride) { continue; } if (megaMorphChan.mTargetCache.Count == 1) { for (int j = num2; j < num3; j++) { int num4 = morphedVerts[j]; Vector3 vector = megaMorphChan.mDeltas[num4]; dif[num4].x += vector.x * megaMorphChan.fChannelPercent; dif[num4].y += vector.y * megaMorphChan.fChannelPercent; dif[num4].z += vector.z * megaMorphChan.fChannelPercent; } continue; } float targetPercent = megaMorphChan.GetTargetPercent(megaMorphChan.segment - 3); float targetPercent2 = megaMorphChan.GetTargetPercent(megaMorphChan.segment - 2); float num5 = megaMorphChan.fProgression - targetPercent; float num6 = targetPercent2 - targetPercent; float u = num5 / num6; for (int k = num2; k < num3; k++) { int num7 = morphedVerts[k]; Vector3 vector2 = oPoints[num7]; array[0] = megaMorphChan.p1[num7]; array[1] = megaMorphChan.p2[num7]; array[2] = megaMorphChan.p3[num7]; array[3] = megaMorphChan.p4[num7]; if (megaMorphChan.segment == 1) { p[0] = array[0]; p[3] = array[1]; array2[1] = array[2] - array[0]; array2[0] = array[1] - array[0]; float sqrMagnitude = array2[1].sqrMagnitude; if (sqrMagnitude == 0f) { p[1] = array[0]; p[2] = array[1]; } else { p[2] = array[1] - Vector3.Dot(array2[0], array2[1]) * megaMorphChan.mCurvature / sqrMagnitude * array2[1]; p[1] = array[0] + megaMorphChan.mCurvature * (p[2] - array[0]); } } else if (megaMorphChan.segment == megaMorphChan.mTargetCache.Count) { p[0] = array[1]; p[3] = array[2]; array2[1] = array[2] - array[0]; array2[0] = array[1] - array[2]; float sqrMagnitude = array2[1].sqrMagnitude; if (sqrMagnitude == 0f) { p[1] = array[0]; p[2] = array[1]; } else { p[1] = array[1] - Vector3.Dot(array2[1], array2[0]) * megaMorphChan.mCurvature / sqrMagnitude * array2[1]; p[2] = array[2] + megaMorphChan.mCurvature * (p[1] - array[2]); } } else { array2[1] = array[2] - array[0]; array2[0] = array[1] - array[0]; float sqrMagnitude = array2[1].sqrMagnitude; p[0] = array[1]; p[3] = array[2]; if (sqrMagnitude == 0f) { p[1] = array[0]; } else { p[1] = array[1] + Vector3.Dot(array2[0], array2[1]) * megaMorphChan.mCurvature / sqrMagnitude * array2[1]; } array2[1] = array[3] - array[1]; array2[0] = array[2] - array[1]; sqrMagnitude = array2[1].sqrMagnitude; if (sqrMagnitude == 0f) { p[2] = array[1]; } else { p[2] = array[2] - Vector3.Dot(array2[0], array2[1]) * megaMorphChan.mCurvature / sqrMagnitude * array2[1]; } } Vector3 b; MegaUtils.Bez3D(out b, ref p, u); dif[num7].x += b.x - vector2.x; dif[num7].y += b.y - vector2.y; dif[num7].z += b.z - vector2.z; } } if (!mtmorphed) { } } public override void DoneMT(MegaModifiers mod) { if (mtmorphed) { for (int i = 0; i < morphMappingFrom.Length; i++) { sverts[morphMappingTo[i]] = dif[morphMappingFrom[i]]; } for (int j = 0; j < nonMorphMappingFrom.Length; j++) { sverts[nonMorphMappingTo[j]] = oPoints[nonMorphMappingFrom[j]]; } } } private int Find(int index) { int num = morphedVerts[index]; for (int i = 0; i < morphMappingFrom.Length; i++) { if (morphMappingFrom[i] > num) { return i; } } return morphMappingFrom.Length - 1; } private void BuildMorphVertInfo(int cores) { int num = morphedVerts.Length / cores; setStart = new int[cores]; setEnd = new int[cores]; copyStart = new int[cores]; copyEnd = new int[cores]; int num2 = 0; int num3 = 0; for (int i = 0; i < cores; i++) { setStart[i] = num2; if (i < cores - 1) { setEnd[i] = Find(num3 + num); } num2 = setEnd[i]; num3 += num; } setEnd[cores - 1] = morphMappingFrom.Length; num2 = 0; num = nonMorphMappingFrom.Length / cores; for (int j = 0; j < cores; j++) { copyStart[j] = num2; copyEnd[j] = num2 + num; num2 += num; } copyEnd[cores - 1] = nonMorphMappingFrom.Length; } public void SetAnimTime(float t) { animtime = t; switch (repeatMode) { case MegaRepeatMode.Loop: animtime = Mathf.Repeat(animtime, looptime); break; case MegaRepeatMode.Clamp: animtime = Mathf.Clamp(animtime, 0f, looptime); break; } SetAnim(animtime); } }