public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c) { switch (currentMode) { case GhostController.ghostMode.kChase: y = c.pacmanLoc.y / 8; x = c.pacmanLoc.x / 8; if (GhostController.Dist(x, y, c.clydeLoc.x / 8, c.clydeLoc.y / 8) < 8) { y = x = 0; } break; case GhostController.ghostMode.kScatter: y = 0; x = 0; break; case GhostController.ghostMode.kDead: x = 13; y = 21; break; case GhostController.ghostMode.kLeavingHouse: x = 13; y = 21; break; default: // no target x = y = 0; break; } }
float GetChasePowerPelletValue(GameController c, xyLoc closestPowerPellet) { if (powerUp) { return(0); } //return 1 - GetQuadraticCurveValue(GhostController.Dist(c.pacmanLoc, GetClosestGhostLoc(c)), .01f, 4); return(1 - GetLinearCurveValue(GhostController.Dist(new xyLoc(c.pacmanLoc.x / 8, c.pacmanLoc.y / 8), closestPowerPellet) * 4, .01f)); }
public void GetTarget(out int x, out int y, GhostController.ghostMode currentMode, GameController c) { // default code that needs to be written x = y = 0; switch (currentMode) { case GhostController.ghostMode.kChase: // Where do you go in chase mode? if (GhostController.Dist(c.clydeLoc.x / 8, c.clydeLoc.y / 8, c.pacmanLoc.x / 8, c.pacmanLoc.y / 8) < 8) { x = c.pacmanLoc.x / 8; y = c.pacmanLoc.y / 8; } else { x = 0; y = 0; } break; case GhostController.ghostMode.kScatter: x = 0; y = 0; // Where do you go in scatter mode? break; case GhostController.ghostMode.kDead: // back in ghost box // Moves to top of ghost box before regenerating x = 13; y = 21; break; case GhostController.ghostMode.kLeavingHouse: // back in ghost box // Moves to top of ghost box before starting regular behavior x = 13; y = 21; break; default: // no target x = y = 0; break; } }
float GetChaseDotValue(GameController c, xyLoc closestDot) { return(1 - GetLinearCurveValue(GhostController.Dist(new xyLoc(c.pacmanLoc.x / 8, c.pacmanLoc.y / 8), closestDot) * 4, .01f) - .2f); }