示例#1
0
        public static bool MoveTowards(SPoint Current_, SPoint Target_, float DistanceDelta_) // return true : reached
        {
            var Vector = Target_.GetSub(Current_);
            var Scalar = Vector.GetScalar();

            if (Scalar > DistanceDelta_)
            {
                Current_.Add(new SPoint(Vector.X * DistanceDelta_ / Scalar, Vector.Y * DistanceDelta_ / Scalar));
                return(false);
            }
            else
            {
                Current_.Set(Target_);
                return(true);
            }
        }