public Vector2Int GetNextTileForWander(GhostPattern pattern, Vector2Int current, Direction direction, bool canReturn = false) { try { return(GetNextTileToVector(current, ghostTargetInVulnerable[pattern], direction, canReturn)); } catch (KeyNotFoundException) { } return(current); }
public Vector2Int GhostPosition(GhostPattern name) { if (name == GhostPattern.Blinky) { return(PrisonPosition() + new Vector2Int(1, 0)); } else if (name == GhostPattern.Inky) { return(PrisonPosition() + new Vector2Int(2, 0)); } else if (name == GhostPattern.Clyde) { return(PrisonPosition() - new Vector2Int(1, 0)); } return(PrisonPosition()); }
void InterpretPattern(GhostPattern p, int measureNum) { for (int i = 0; i < p.notes.Length; i++) { Vector2 boostPos; if (p.notes[i].player == Player.p1) { boostPos = boostPoint1; } else { boostPos = boostPoint2; } spawnQ.Enqueue(SpawnOne(p.notes[i], startPoint, boostPos, measureNum)); } }
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); }