//加速模式连续透明变化 public static MotionAestheticsScrp AccTransparentingList(GameObject go, float from, List <float> toList, float time, float speedV, bool isStartV, float delayTime = 0, string sign = "", bool isRecoverMaterial = false) { if (go == null || time < 0 || from < 0 || from > 1) { return(null); } List <Vector3> transparentList = new List <Vector3>(); for (int i = 0; i < toList.Count; i++) { float a = toList[i]; if (a < 0 || a > 1) { return(null); } transparentList.Add(new Vector3(a, 0, 0)); } MotionAestheticsScrp motionAth = GetTransparentScrp(go); motionAth.BeginAccList(MABRANCH.TRANSPARENT, go, new Vector3(from, 0, 0), transparentList, time, speedV, isStartV, delayTime, sign, true, isRecoverMaterial); return(motionAth); }
//滚动面板 public void RollPanel(int step) { //到达尽头,至少有一个留在展示区 if ((FPToPPI <= -PanelCount + StayCount && step < 0) || (FPToPPI >= PresentPosCount - StayCount && step > 0)) { BorderEffect(step); return; } AutoSortPanel(step); int newFPToPPI = FPToPPI + step; //纠正参数 if (newFPToPPI < -PanelCount + StayCount) { newFPToPPI = -PanelCount + StayCount; } if (newFPToPPI > PresentPosCount - StayCount) { newFPToPPI = PresentPosCount - StayCount; } //滚动 for (int i = 0; i < PanelCount; i++) { int presentPosIndex = FPToPPI + i; int newPresentPosIndex = newFPToPPI + i; if (presentPosIndex < 0) { presentPosIndex = 0; } else if (presentPosIndex > PresentPosCount - 1) { presentPosIndex = PresentPosCount - 1; } if (newPresentPosIndex < 0) { newPresentPosIndex = 0; } else if (newPresentPosIndex > PresentPosCount - 1) { newPresentPosIndex = PresentPosCount - 1; } //起点或者终点在展示区 if ((presentPosIndex >= 0 && presentPosIndex <= PresentPosCount - 1) || (newPresentPosIndex >= 0 && newPresentPosIndex <= PresentPosCount - 1)) { MotionAestheticsScrp.AccTranslating(Panels[i].gameObject, PresentPositions[presentPosIndex], PresentPositions[newPresentPosIndex], GlobalVariable.AnimationSpendTime, AnimCurve); } } FPToPPI = newFPToPPI; }
public static MotionAestheticsScrp AccTransparenting(GameObject go, float to, float time, float speedV, bool isStartV, int loop = 1, float delayTime = 0, string sign = "", bool isRecoverMaterial = false) { if (go == null || time < 0 || loop == 0 || to < 0 || to > 1) { return(null); } MotionAestheticsScrp motionAth = GetTransparentScrp(go); motionAth.BeginAcc(MABRANCH.TRANSPARENT, go, new Vector3(-1, 0, 0), new Vector3(to, 0, 0), time, speedV, isStartV, loop, delayTime, sign, true, isRecoverMaterial); return(motionAth); }
public static MotionAestheticsScrp AccColorChanging(GameObject go, Color from, Color to, float time, AnimationCurve animCurve, int loop = 1, float delayTime = 0, string sign = "", bool isKeepLive = false) { if (go == null || time < 0 || loop == 0) { return(null); } MotionAestheticsScrp motionAth = go.AddComponent <MotionAestheticsScrp>(); motionAth.BeginAccColor(go, from, to, time, animCurve, loop, delayTime, sign, isKeepLive); return(motionAth); }
public static MotionAestheticsScrp AccLocalScaling(GameObject go, Vector3 from, Vector3 to, float time, float speedV, bool isStartV, int loop = 1, float delayTime = 0, string sign = "", bool isKeepLive = false) { if (go == null || time < 0 || loop == 0) { return(null); } MotionAestheticsScrp motionAth = go.AddComponent <MotionAestheticsScrp>(); motionAth.BeginAcc(MABRANCH.SCALE, go, from, to, time, speedV, isStartV, loop, delayTime, sign, isKeepLive); return(motionAth); }
public static MotionAestheticsScrp AccLocalRotating(GameObject go, Vector3 Axis, float angle, float time, AnimationCurve animCurve, int loop = 1, float delayTime = 0, string sign = "", bool isKeepLive = false) { if (go == null || time < 0 || loop == 0) { return(null); } MotionAestheticsScrp motionAth = go.AddComponent <MotionAestheticsScrp>(); motionAth.m_isLocalAround = true; motionAth.BeginAcc(go, Axis, angle, time, animCurve, loop, delayTime, sign, isKeepLive); return(motionAth); }
//新添加旋转 public static MotionAestheticsScrp AccLocalRotating(GameObject go, Vector3 from, Vector3 to, float time, AnimationCurve animCurve, int loop = 1, float delayTime = 0, string sign = "", bool isKeepLive = false) { if (go == null || time < 0 || loop == 0) { return(null); } MotionAestheticsScrp motionAth = go.AddComponent <MotionAestheticsScrp>(); motionAth.m_isLocalEuler = true; motionAth.BeginAcc(MABRANCH.ROTATE, go, from, to, time, animCurve, loop, delayTime, sign, isKeepLive); return(motionAth); }
//获取透明脚本或者添加脚本 static MotionAestheticsScrp GetTransparentScrp(GameObject go) { MotionAestheticsScrp ma = GetBranchScrp(go, MABRANCH.TRANSPARENT); if (ma != null) { return(ma); } else { return(go.AddComponent <MotionAestheticsScrp>()); } }
public static void AccTranslating(GameObject go, Transform from, Transform to, float time, float speedV, bool isStartV, int loop, float delayTime = 0, string sign = "", bool isKeepLive = false) { if (go == null || time < 0 || loop == 0) { return; } MotionAestheticsScrp motionAth = go.AddComponent <MotionAestheticsScrp>(); MotionAestheticsScrp motionAth1 = go.AddComponent <MotionAestheticsScrp>(); MotionAestheticsScrp motionAth2 = go.AddComponent <MotionAestheticsScrp>(); motionAth.BeginAcc(MABRANCH.MOVE, go, from.position, to.position, time, speedV, isStartV, loop, delayTime, sign, isKeepLive); Vector3 eulerFrom = from.eulerAngles; Vector3 eulerTo = to.eulerAngles; EulerAnglesOptimize(ref eulerFrom, ref eulerTo); motionAth1.BeginAcc(MABRANCH.ROTATE, go, eulerFrom, eulerTo, time, speedV, isStartV, loop, delayTime, sign, isKeepLive); motionAth2.BeginAcc(MABRANCH.SCALE, go, from.localScale, to.localScale, time, speedV, isStartV, loop, delayTime, sign, isKeepLive); }
public static void FixedDecMoving(GameObject go, Vector3 dir, float units, float delayTime = 0, Space relativeTo = Space.Self, string sign = "", bool isKeepLive = false) { if (go == null) { return; } Transform toTrans = (Instantiate(go) as GameObject).transform; toTrans.position = go.transform.position; toTrans.eulerAngles = go.transform.eulerAngles; toTrans.localScale = go.transform.localScale; toTrans.Translate(dir.normalized * units, relativeTo); Vector3 to = toTrans.position; Destroy(toTrans.gameObject); MotionAestheticsScrp motionAth = go.AddComponent <MotionAestheticsScrp>(); motionAth.BeginFixedDecMove(MABRANCH.MOVE, go, go.transform.position, to, delayTime, sign, isKeepLive); }
//加速模式变化连续目标 public static void AccTranslatingList(GameObject go, Transform from, List <Transform> toList, float time, float speedV, bool isStartV, float delayTime = 0, string sign = "", bool isKeepLive = false) { if (go == null || time < 0) { return; } List <Vector3>[] branchArray = new List <Vector3> [3];//new的数组其实要删除 for (int i = 0; i < toList.Count; i++) { branchArray[0].Add(toList[i].position); branchArray[1].Add(toList[i].eulerAngles); branchArray[2].Add(toList[i].localScale); } MotionAestheticsScrp motionAth = go.AddComponent <MotionAestheticsScrp>(); MotionAestheticsScrp motionAth1 = go.AddComponent <MotionAestheticsScrp>(); MotionAestheticsScrp motionAth2 = go.AddComponent <MotionAestheticsScrp>(); motionAth.BeginAccList(MABRANCH.MOVE, go, from.position, branchArray[0], time, speedV, isStartV, delayTime, sign, isKeepLive); motionAth1.BeginAccList(MABRANCH.ROTATE, go, from.eulerAngles, branchArray[1], time, speedV, isStartV, delayTime, sign, isKeepLive); motionAth2.BeginAccList(MABRANCH.SCALE, go, from.localScale, branchArray[2], time, speedV, isStartV, delayTime, sign, isKeepLive); }
//边界效果 void BorderEffect(int step) { for (int i = 0; i < PanelCount; i++) { int presentPosIndex = FPToPPI + i; if (presentPosIndex >= 0 && presentPosIndex <= PresentPosCount - 1) { int index; if (step < 0) { index = 0; } else if (step > 0) { index = PresentPosCount - 1; } else { break; } MotionAestheticsScrp.AccTranslating(Panels[i].gameObject, PresentPositions[presentPosIndex], PresentPositions[index], GlobalVariable.AnimationSpendTime, BorderAnimCurve); } } }