public void PacmanHasInitialDirection(Pacman.Direction testDirection) { var pacman = new Pacman(); pacman.Turn(testDirection); Assert.Equal(testDirection, pacman.GetDirection()); }
public void RotateLeftTest() { Direction _direction = Direction.SOUTH; switch (_direction) { case Direction.NORTH: _direction = Direction.WEST; break; default: _direction = _direction - 1; break; } _pacman.SetPacmanDir(_direction.ToString()); Assert.AreEqual(Direction.EAST, _pacman.GetDirection()); }
public void PacmanHasInitialDirection(Pacman.Direction testDirection) { var pacman = new Pacman(); pacman.Turn(testDirection); Assert.Equal(testDirection, pacman.GetDirection()); }
public Vector2Int GetNextTileToPlayer(GhostPattern pattern, Vector2Int current, Direction direction, bool canReturn = false) { if (pacman != null) { Vector2Int target = new Vector2Int(); if (pattern == GhostPattern.Blinky) { target.x = Mathf.RoundToInt(pacman.transform.position.x); target.y = Mathf.RoundToInt(pacman.transform.position.y); target = CoordInRange(target); blinkyPosition = current; } else if (pattern == GhostPattern.Pinky) { target.x = Mathf.RoundToInt(pacman.transform.position.x) + Global.directions[(int)pacman.GetDirection()].x * 4; target.y = Mathf.RoundToInt(pacman.transform.position.y) + Global.directions[(int)pacman.GetDirection()].y * 4; } else if (pattern == GhostPattern.Inky) { target.x = Mathf.RoundToInt(pacman.transform.position.x) + Global.directions[(int)pacman.GetDirection()].x * 2; target.y = Mathf.RoundToInt(pacman.transform.position.y) + Global.directions[(int)pacman.GetDirection()].y * 2; target += (target - blinkyPosition); } else if (pattern == GhostPattern.Clyde) { target.x = Mathf.RoundToInt(pacman.transform.position.x); target.y = Mathf.RoundToInt(pacman.transform.position.y); if (Mathf.Abs(target.x - current.x) + Mathf.Abs(target.y - current.y) <= 8) { target = new Vector2Int(1, 1); } } return(GetNextTileToVector(current, target, direction, canReturn)); } return(current); }