예제 #1
0
        public void follow()
        {
            switch (followMode)
            {
            case FollowMode.GLUED:
                location = target.getLocation();
                break;

            case FollowMode.FIXED:
                break;

            case FollowMode.STEADY:
                Point t = target.getLocation();

                location.X += Math.Sign(t.X - location.X) * (int)Math.Ceiling(Math.Sqrt(Math.Abs(location.X - t.X)));
                location.Y += Math.Sign(t.Y - location.Y) * (int)Math.Ceiling(Math.Sqrt(Math.Abs(location.Y - t.Y)));

                break;
            }
        }
예제 #2
0
 public void setTarget(HasLocation target)
 {
     this.target   = target;
     this.location = new Point(target.getLocation().X, target.getLocation().Y);
 }