private int TurtleTurnRight(IntPtr result, IntPtr arguments, IntPtr userData) { VlsForeignAccessor accessor = new VlsForeignAccessor(result, arguments); double angle = accessor.Get <double>(); this.turtleDirection += angle; return(accessor.Size); }
private int TurtleMove(IntPtr result, IntPtr arguments, IntPtr userData) { VlsForeignAccessor accessor = new VlsForeignAccessor(result, arguments); double length = accessor.Get <double>(); double originX, originY, finalX, finalY; originX = this.turtleX; originY = this.turtleY; TurtleGetDestination(length, out finalX, out finalY); int steps = (int)Math.Round(this.turtleFPS * (length / this.turtleSpeed)); double stepLength = this.turtleSpeed / this.turtleFPS; for (int i = 0; i < steps; i++) { TurtleGo(stepLength, originX, originY, false); } this.turtleX = originX; this.turtleY = originY; TurtleGo(length, originX, originY, true); return(accessor.Size); }