Ejemplo n.º 1
0
        private Vector3 GetNextPoint(PlayerEntity player, Vector3 from, Vector3 to, float dis)
        {
            Vector3 v = to;

            if (dis > 100)
            {
                v = AutoMoveUtil.GetDistancePoint(from, to, 100);
            }

            if (AutoMoveUtil.CanDirectMoveTo(from, to))
            {
                return(v);
            }
            else
            {
                v = GetDirectMovePos(from, to, Math.Min((int)Vector3.Distance(from, to), 100));
            }

            return(v);
        }
Ejemplo n.º 2
0
        private Vector3 GetDirectMovePos(Vector3 from, Vector3 to, int dis)
        {
            for (int i = 1; i <= 18; i++)
            {
                Vector3 deltaV = AutoMoveUtil.GetGround(AutoMoveUtil.GetRotationPos(from, to, i * 10, dis)).point;
                if (AutoMoveUtil.CanDirectMoveTo(from, deltaV))
                {
                    Debug.LogFormat("select angle {0}, pos:{1}", i * 10, deltaV);
                    return(deltaV);
                }
                deltaV = AutoMoveUtil.GetGround(AutoMoveUtil.GetRotationPos(from, to, -i * 10, dis)).point;
                if (AutoMoveUtil.CanDirectMoveTo(from, deltaV))
                {
                    Debug.LogFormat("select angle {0}, pos:{1}", -i * 10, deltaV);
                    return(deltaV);
                }
            }

            Debug.LogFormat("select none");

            return(to);
        }