public void push(Robot.Direction dir) { Dir = dir; switch (dir) { case Robot.Direction.Down: vel.Y = speed; vel.X = 0; break; case Robot.Direction.Up: vel.Y = -speed; vel.X = 0; break; case Robot.Direction.Right: vel.X = speed; vel.Y = 0; break; case Robot.Direction.Left: vel.X = -speed; vel.Y = 0; break; } Point tileToCheck = Robot.Adjacent(Center, dir); if (game.GameScreen.stage.PassableLayer[tileToCheck.X, tileToCheck.Y]) { moving = true; game.GameScreen.stage.PassableLayer[Stage.PosToTile(Center).X, Stage.PosToTile(Center).Y] = true; } }
private void AddConveyor(Point tile, Robot.Direction dir) { Rectangle initSource = new Rectangle(832, 192, TileSize, TileSize); switch (dir) { case Robot.Direction.Left: initSource.Y += 64; break; case Robot.Direction.Up: initSource.Y += 128; break; case Robot.Direction.Down: initSource.Y += 192; break; } var con = new Conveyer(game, batch, game.Content.Load <Texture2D>(objTexName), TileToPos(tile), initSource, 3, 1.0f / 10.0f, true, 2, dir); con.PlayAnimation(); objects.Add(con); }
public void placeRobotOnBoard(Robot robot, string xCoord, string yCoord, string direction) { robot._currentHeightPosition = Convert.ToInt32(yCoord); robot._currentLengthPosition = Convert.ToInt32(xCoord); Robot.Direction di = (Robot.Direction)Enum.Parse(typeof(Robot.Direction), direction); robot.directionFacing = di; robot._isRobotPlaced = true; }
private void moveRobot(Robot robot) { Robot.Direction directionOfRobot = robot.directionFacing; switch (directionOfRobot) { case Robot.Direction.NORTH: robot._currentHeightPosition = robot._currentHeightPosition + 1; break; case Robot.Direction.EAST: robot._currentLengthPosition = robot._currentLengthPosition + 1; break; case Robot.Direction.SOUTH: robot._currentHeightPosition = robot._currentHeightPosition - 1; break; case Robot.Direction.WEST: robot._currentLengthPosition = robot._currentLengthPosition - 1; break; } }
public Conveyer(ADHDGame g, SpriteBatch sb, Texture2D t, Vector2 position, Rectangle init, int nFrames, float rate, bool l, int type, Robot.Direction dir) : base(g, sb, t, position, init, nFrames, rate, l, type) { cdir = dir; rec = new Rectangle((int)position.X, (int)position.Y, Stage.TileSize, Stage.TileSize); }