Exemple #1
0
 private static void EulerTo(Transform trans, Vector3 start, Vector3 end, BehaviourCallback beh)
 {
     if (trans != null)
     {
         trans.eulerAngles = MathUtils.Interpolation(start, end, beh.Percent);
     }
 }
Exemple #2
0
 private static void LocalMoveTo(Transform trans, Vector3 start, Vector3 end, BehaviourCallback beh)
 {
     if (trans != null)
     {
         trans.localPosition = MathUtils.Interpolation(start, end, beh.Percent);
     }
 }
Exemple #3
0
        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);
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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);
        }
Exemple #10
0
 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();
     }
 }
Exemple #11
0
        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);
        }
Exemple #12
0
 private static void FillAmount(Image img, float start, float end, BehaviourCallback bc)
 {
     img.fillAmount = MathUtils.Interpolation(start, end, bc.Percent);
 }
Exemple #13
0
 private static void ColorTo(Material mat, Color start, Color end, BehaviourCallback bc)
 {
     mat.color = MathUtils.Interpolation(start, end, bc.Percent);
 }
Exemple #14
0
 public override void Reset()
 {
     Current = null;
     base.Reset();
 }
Exemple #15
0
 internal override void NextBehaviour()
 {
     Current = null;
     ConsumeChild();
 }
Exemple #16
0
 private static void LocalRotateTo(Transform trans, Quaternion start, Quaternion end, BehaviourCallback beh)
 {
     if (trans != null)
     {
         // 采用线性插值
         trans.localRotation = Quaternion.Lerp(start, end, beh.Percent);
     }
 }
Exemple #17
0
 public override void Clear()
 {
     Current = null;
     base.Clear();
 }
Exemple #18
0
 private static void PathTo(NavPathController pathCtl, BehaviourCallback beh)
 {
     pathCtl.Update(Time.deltaTime);
 }
Exemple #19
0
 internal SequenceOne() : base()
 {
     Current = null;
 }