private static void TestRobot() { RobotEntity robot; BoardEntity board; var scene = new RootComponent() .Attach(board = new BoardEntity()) .Attach(robot = new RobotEntity()); robot.Place(new Vector(3f, 3f, 0f), CardinalDirection.South); robot.Move(); robot.Move(); Console.WriteLine($"Robot position: {robot.GetPosition().X}, {robot.GetPosition().Y}"); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateLeft(); robot.RotateLeft(); robot.Move(); Console.WriteLine($"Robot position: {robot.GetPosition().X}, {robot.GetPosition().Y}"); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.Move(); Console.WriteLine($"Robot position: {robot.GetPosition().X}, {robot.GetPosition().Y}"); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); // Console.WriteLine($"Robot is spawned: {robot.IsSpawned}"); robot.RotateLeft(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateLeft(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateLeft(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateLeft(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateRight(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateRight(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateRight(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); robot.RotateRight(); Console.WriteLine($"Robot orientation: {Orientation.FromVector(robot.GetOrientation()).CardinalDirection}"); }
private object DoLeft(LeftOptions options) { _robot.RotateLeft(); return(null); }