private static void EulerTo(Transform trans, Vector3 start, Vector3 end, BehaviourCallback beh) { if (trans != null) { trans.eulerAngles = MathUtils.Interpolation(start, end, beh.Percent); } }
private static void LocalMoveTo(Transform trans, Vector3 start, Vector3 end, BehaviourCallback beh) { if (trans != null) { trans.localPosition = MathUtils.Interpolation(start, end, beh.Percent); } }
private static void ColorAlphaTo(Material mat, float start, float end, BehaviourCallback bc) { float a = MathUtils.Interpolation(start, end, bc.Percent); Color c = mat.color; c.a = a; mat.color = c; }
private BehaviourCallback FindBehaviour(string tag) { BehaviourCallback res = FindBehaviour(tag, mAddBehaviourCaches); if (res == null) { res = FindBehaviour(tag, mBehaviours); } return(res); }
/// <summary> /// 这里指挥清理一个,添加的时候确保只有一个 Tag /// </summary> /// <param name="tag"></param> public bool Resume(string tag) { BehaviourCallback bc = FindBehaviour(tag); if (bc != null) { mBehaviours.Remove(bc); return(true); } return(false); }
public static BehaviourCallback FillAmount(this Image img, float startV, float endV) { Callback4 <Image, float, float, BehaviourCallback> callback = new Callback4 <Image, float, float, BehaviourCallback>(); callback.Arg1 = img; callback.Arg2 = startV; callback.Arg3 = endV; callback.Handler = (Action <Image, float, float, BehaviourCallback>)FillAmount; BehaviourCallback beh = new BehaviourCallback(callback, callback, callback); callback.Arg4 = beh; return(beh); }
public static BehaviourCallback RotateTo(this Transform trans, Quaternion end) { Callback4 <Transform, Quaternion, Quaternion, BehaviourCallback> callback = new Callback4 <Transform, Quaternion, Quaternion, BehaviourCallback>(); callback.Arg1 = trans; callback.Arg2 = trans.rotation; callback.Arg3 = end; callback.Handler = (Action <Transform, Quaternion, Quaternion, BehaviourCallback>)RotateTo; BehaviourCallback beh = new BehaviourCallback(callback, callback, callback); callback.Arg4 = beh; return(beh); }
public static BehaviourCallback ColorTo(this Material mat, Color startV, Color endV) { Callback4 <Material, Color, Color, BehaviourCallback> callback = new Callback4 <Material, Color, Color, BehaviourCallback>(); callback.Arg1 = mat; callback.Arg2 = startV; callback.Arg3 = endV; callback.Handler = (Action <Material, Color, Color, BehaviourCallback>)ColorTo; BehaviourCallback beh = new BehaviourCallback(callback, callback, callback); callback.Arg4 = beh; return(beh); }
public static BehaviourCallback LocalScaleTo(this Transform trans, Vector3 end) { Callback4 <Transform, Vector3, Vector3, BehaviourCallback> callback = new Callback4 <Transform, Vector3, Vector3, BehaviourCallback>(); callback.Arg1 = trans; callback.Arg2 = trans.localScale; callback.Arg3 = end; callback.Handler = (Action <Transform, Vector3, Vector3, BehaviourCallback>)LocalScaleTo; BehaviourCallback beh = new BehaviourCallback(callback, callback, callback); callback.Arg4 = beh; return(beh); }
internal void ConsumeChild() { if ((Current == null || Current.IsFinished)) { Current = null; } if (Current == null && mBehaviours.Count > 0) { Current = mBehaviours.First.Value; mBehaviours.RemoveFirst(); } if (Current == null) { InvokeCompletion(); } }
public static BehaviourCallback NavPathTo(this Transform trans, float duration, List <Vector3> waypoints, Vector3 offset, IPathTrigger triggerHandler = null, NavPathFlipType flipType = NavPathFlipType.None, NavPathMoveType pathType = NavPathMoveType.LinePosLineDir, int subdivisions = 5, float pathLength = 0.0f) { NavPathController pathCtrl = new NavPathController(); AbstractNavPath navPath = NavPathUtils.Create(pathType, offset, flipType, triggerHandler, waypoints, subdivisions, pathLength); pathCtrl.StartMove(navPath, navPath.PathLength / duration); pathCtrl.mCtlPosition = trans; pathCtrl.mCtlRotate = trans; Callback2 <NavPathController, BehaviourCallback> callback = new Callback2 <NavPathController, BehaviourCallback>(); callback.Arg1 = pathCtrl; callback.Handler = (Action <NavPathController, BehaviourCallback>)PathTo; BehaviourCallback beh = new BehaviourCallback(callback, callback, callback); callback.Arg2 = beh; return(beh); }
private static void FillAmount(Image img, float start, float end, BehaviourCallback bc) { img.fillAmount = MathUtils.Interpolation(start, end, bc.Percent); }
private static void ColorTo(Material mat, Color start, Color end, BehaviourCallback bc) { mat.color = MathUtils.Interpolation(start, end, bc.Percent); }
public override void Reset() { Current = null; base.Reset(); }
internal override void NextBehaviour() { Current = null; ConsumeChild(); }
private static void LocalRotateTo(Transform trans, Quaternion start, Quaternion end, BehaviourCallback beh) { if (trans != null) { // 采用线性插值 trans.localRotation = Quaternion.Lerp(start, end, beh.Percent); } }
public override void Clear() { Current = null; base.Clear(); }
private static void PathTo(NavPathController pathCtl, BehaviourCallback beh) { pathCtl.Update(Time.deltaTime); }
internal SequenceOne() : base() { Current = null; }