public void CubicVectorBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight, bool isPos) { int indexOfEvent = _track.GetIndexOfEvent(_prevEvent); int indexOfEvent2 = _track.GetIndexOfEvent(this); int eventsCount = _track.GetEventsCount(); int num = indexOfEvent - 1; if (num < 0) { if (_action.loop) { num = eventsCount - 1; if (num < 0) { num = 0; } } else { num = 0; } } int num2 = indexOfEvent2 + 1; if (num2 >= eventsCount) { if (_action.loop) { num2 = 0; } else { num2 = indexOfEvent2; } } ModifyTransform modifyTransform = _prevEvent as ModifyTransform; ModifyTransform modifyTransform2 = _track.GetEvent(num) as ModifyTransform; ModifyTransform modifyTransform3 = _track.GetEvent(num2) as ModifyTransform; DebugHelper.Assert(modifyTransform != null && modifyTransform2 != null && modifyTransform3 != null, "��һ�Ѷ���Ӧ��Ϊ��"); Vector3 vector = isPos ? modifyTransform.GetTranslation(_action) : modifyTransform.scaling; Vector3 vector2 = isPos ? this.GetTranslation(_action) : this.scaling; Vector3 formPoint = isPos ? modifyTransform2.GetTranslation(_action) : modifyTransform2.scaling; Vector3 lattPoint = isPos ? modifyTransform3.GetTranslation(_action) : modifyTransform3.scaling; Vector3 a; Vector3 a2; CurvlData.CalculateCtrlPoint(formPoint, vector, vector2, lattPoint, out a, out a2); float d = 1f - _blendWeight; Vector3 vector3 = vector * d * d * d + a * 3f * d * d * _blendWeight + a2 * 3f * d * _blendWeight * _blendWeight + vector2 * _blendWeight * _blendWeight * _blendWeight; if (isPos) { _action.GetGameObject(this.targetId).transform.position = vector3; } else { _action.GetGameObject(this.targetId).transform.localScale = vector3; } }
public CurvlData CreateCurvl() { if (this.curvlLst == null) { this.curvlLst = new ListView <CurvlData>(); } CurvlData curvlData; for (int i = 0; i < this.curvlLst.get_Count(); i++) { curvlData = this.curvlLst.get_Item(i); if (curvlData == null) { curvlData = new CurvlData(i); curvlData.SetCurvlID(i); this.curvlLst.set_Item(i, curvlData); return(curvlData); } if (!curvlData.isInUse) { curvlData.isInUse = true; return(curvlData); } } curvlData = new CurvlData(this.curvlLst.get_Count()); curvlData.SetCurvlID(this.curvlLst.get_Count()); this.curvlLst.Add(curvlData); return(curvlData); }
public CurvlData CreateCurvl() { CurvlData data; if (this.curvlLst == null) { this.curvlLst = new ListView <CurvlData>(); } for (int i = 0; i < this.curvlLst.Count; i++) { data = this.curvlLst[i]; if (data == null) { data = new CurvlData(i); data.SetCurvlID(i); this.curvlLst[i] = data; return(data); } if (!data.isInUse) { data.isInUse = true; return(data); } } data = new CurvlData(this.curvlLst.Count); data.SetCurvlID(this.curvlLst.Count); this.curvlLst.Add(data); return(data); }
public void RemoveAllCurvl(bool destroy) { if (this.curvlLst != null) { using (ListView <CurvlData> .Enumerator enumerator = this.curvlLst.GetEnumerator()) { while (enumerator.MoveNext()) { CurvlData current = enumerator.get_Current(); if (current != null) { current.Remove(destroy); if (!destroy) { this.curvlLst.set_Item(current.GetCurvlID(), null); } } } } if (destroy) { this.curvlLst.Clear(); } } if (destroy) { GameObject gameObject = GameObject.Find(CurvlHelper.sCurvlHelperObjName); if (gameObject) { List <GameObject> list = new List <GameObject>(); int childCount = gameObject.transform.childCount; for (int i = 0; i < childCount; i++) { Transform child = gameObject.transform.GetChild(i); int childCount2 = child.childCount; for (int j = 0; j < childCount2; j++) { Transform child2 = child.GetChild(j); list.Add(child2.gameObject); } list.Add(child.gameObject); } using (List <GameObject> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { GameObject current2 = enumerator2.get_Current(); ActionManager.DestroyGameObject(current2); } } } } }
public CurvlData InsertCurvl(int index) { if (this.curvlLst == null) { this.curvlLst = new ListView <CurvlData>(); } if (index < 0) { return(null); } CurvlData curvlData; if (index >= this.curvlLst.get_Count()) { curvlData = new CurvlData(this.curvlLst.get_Count()); curvlData.SetCurvlID(this.curvlLst.get_Count()); this.curvlLst.Add(curvlData); } else { curvlData = this.curvlLst.get_Item(index); if (curvlData == null) { curvlData = new CurvlData(index); curvlData.SetCurvlID(index); this.curvlLst.set_Item(index, curvlData); } else if (!curvlData.isInUse) { curvlData.isInUse = true; } else { this.curvlLst.Insert(index, null); for (int i = index + 1; i < this.curvlLst.get_Count(); i++) { CurvlData curvlData2 = this.curvlLst.get_Item(i); if (curvlData2 != null) { curvlData2.SetCurvlID(i); } } curvlData = new CurvlData(index); curvlData.SetCurvlID(index); this.curvlLst.set_Item(index, curvlData); } } return(curvlData); }
public CurvlData InsertCurvl(int index) { CurvlData data; if (this.curvlLst == null) { this.curvlLst = new ListView <CurvlData>(); } if (index < 0) { return(null); } if (index >= this.curvlLst.Count) { data = new CurvlData(this.curvlLst.Count); data.SetCurvlID(this.curvlLst.Count); this.curvlLst.Add(data); return(data); } data = this.curvlLst[index]; if (data == null) { data = new CurvlData(index); data.SetCurvlID(index); this.curvlLst[index] = data; return(data); } if (!data.isInUse) { data.isInUse = true; return(data); } this.curvlLst.Insert(index, null); for (int i = index + 1; i < this.curvlLst.Count; i++) { CurvlData data2 = this.curvlLst[i]; if (data2 != null) { data2.SetCurvlID(i); } } data = new CurvlData(index); data.SetCurvlID(index); this.curvlLst[index] = data; return(data); }
public void Draw() { if (this.curvlLst == null) { this.HideUnactiveCurvls(); return; } using (ListView <CurvlData> .Enumerator enumerator = this.curvlLst.GetEnumerator()) { while (enumerator.MoveNext()) { CurvlData current = enumerator.get_Current(); if (current != null) { current.stepsOfEachSegment = this.lineStep; current.DrawCurvel(this.useSameInterpMode); } } } }
public void RemoveCurvl(int index, bool destroy) { CurvlData curvlData = this.GetCurvl(index); if (curvlData != null) { curvlData.Remove(destroy); if (destroy) { this.curvlLst.RemoveAt(index); for (int i = index; i < this.curvlLst.get_Count(); i++) { curvlData = this.curvlLst.get_Item(i); if (curvlData != null) { curvlData.SetCurvlID(i); } } } } }
public void RemoveCurvl(int index, bool destroy) { CurvlData curvl = this.GetCurvl(index); if (curvl != null) { curvl.Remove(destroy); if (destroy) { this.curvlLst.RemoveAt(index); for (int i = index; i < this.curvlLst.Count; i++) { curvl = this.curvlLst[i]; if (curvl != null) { curvl.SetCurvlID(i); } } } } }
public void CubicVectorBlend(Action _action, Track _track, TickEvent _prevEvent, float _blendWeight, bool isPos) { Vector3 vector5; Vector3 vector6; int indexOfEvent = _track.GetIndexOfEvent(_prevEvent); int num2 = _track.GetIndexOfEvent(this); int eventsCount = _track.GetEventsCount(); int index = indexOfEvent - 1; if (index < 0) { if (_action.loop) { index = eventsCount - 1; if (index < 0) { index = 0; } } else { index = 0; } } int num5 = num2 + 1; if (num5 >= eventsCount) { if (_action.loop) { num5 = 0; } else { num5 = num2; } } ModifyTransform transform = _prevEvent as ModifyTransform; ModifyTransform transform2 = _track.GetEvent(index) as ModifyTransform; ModifyTransform transform3 = _track.GetEvent(num5) as ModifyTransform; DebugHelper.Assert(((transform != null) && (transform2 != null)) && (transform3 != null), "��һ�Ѷ���Ӧ��Ϊ��"); Vector3 prevPoint = !isPos ? transform.scaling : transform.GetTranslation(_action); Vector3 curnPoint = !isPos ? this.scaling : this.GetTranslation(_action); Vector3 formPoint = !isPos ? transform2.scaling : transform2.GetTranslation(_action); Vector3 lattPoint = !isPos ? transform3.scaling : transform3.GetTranslation(_action); CurvlData.CalculateCtrlPoint(formPoint, prevPoint, curnPoint, lattPoint, out vector5, out vector6); float num6 = 1f - _blendWeight; float num7 = _blendWeight; Vector3 vector7 = (Vector3)((((((prevPoint * num6) * num6) * num6) + ((((vector5 * 3f) * num6) * num6) * num7)) + ((((vector6 * 3f) * num6) * num7) * num7)) + (((curnPoint * num7) * num7) * num7)); if (isPos) { _action.GetGameObject(this.targetId).transform.position = vector7; } else { _action.GetGameObject(this.targetId).transform.localScale = vector7; } }
private void CreateCurvlPoints(bool useUnifyInterp) { if (this.curvePoints == null) { this.curvePoints = new List <Vector3>(); } if (this.controlPoints == null) { this.controlPoints = new Vector3[4]; } int count = this.nodeLst.Count; this.curvePointCount = 0; float stepLen = 1f / (float)this.stepsOfEachSegment; for (int i = 0; i < count; i++) { if (this.closeCurvl || i != 0) { int num = i - 1; if (num < 0) { if (this.closeCurvl) { num = count - 1; } else { num = 0; } } int num2 = i - 2; if (num2 < 0) { if (this.closeCurvl) { num2 = count - 1; } else { num2 = 0; } } int num3 = i + 1; if (num3 >= count) { if (this.closeCurvl) { num3 = 0; } else { num3 = i; } } Vector3 pos = this.nodeLst[num].pos; Vector3 pos2 = this.nodeLst[i].pos; Vector3 pos3 = this.nodeLst[num2].pos; Vector3 pos4 = this.nodeLst[num3].pos; if ((useUnifyInterp && !this.isCubic) || (!useUnifyInterp && !this.nodeLst[i].isCubic)) { if (this.curvePoints.get_Count() <= this.curvePointCount) { this.curvePoints.Add(pos); } else { this.curvePoints.set_Item(this.curvePointCount, pos); } this.curvePointCount++; if (this.curvePoints.get_Count() <= this.curvePointCount) { this.curvePoints.Add(pos2); } else { this.curvePoints.set_Item(this.curvePointCount, pos2); } this.curvePointCount++; } else { Vector3 ctrlPoint; Vector3 ctrlPoint2; CurvlData.CalculateCtrlPoint(pos3, pos, pos2, pos4, out ctrlPoint, out ctrlPoint2); this.CalculateCurvlPoints(pos, pos2, ctrlPoint, ctrlPoint2, stepLen); } } } }