public void AddGhost(Ghost.GhostName name, int px, int py, Ghost.GhostState gs, int homeTileX, int homeTileY) { var g = new Ghost(_spritesheet, name, px, py, gs); g.SetHomeTile(homeTileX, homeTileY); _ghosts.Add(g); }
bool IsGhostNameInUse(Ghost.GhostName gn, int used) { for (int i = 0; i < used; ++i) { if (GhostNames [i] == gn) { return(true); } } return(false); }
void AddGhosts() { Ghost.GhostName g0 = MapManager.MapMgrSingleton.GetGhost(0); Ghost.GhostName g1 = MapManager.MapMgrSingleton.GetGhost(1); Ghost.GhostName g2 = MapManager.MapMgrSingleton.GetGhost(2); Ghost.GhostName g3 = MapManager.MapMgrSingleton.GetGhost(3); GhostManager.GhostMgrSingleton.AddGhost(g0, 40, 40, Ghost.GhostState.CHASE, 9, -1); GhostManager.GhostMgrSingleton.AddGhost(g1, 24, 32, Ghost.GhostState.CAGED, -1, -1); GhostManager.GhostMgrSingleton.AddGhost(g2, 28, 32, Ghost.GhostState.CAGED, -1, 9); GhostManager.GhostMgrSingleton.AddGhost(g3, 32, 32, Ghost.GhostState.CAGED, 9, 9); }
void InitializeConstrainedLevel(int bmx, int bmy) { var cm = new ConstraintMap(bmx, bmy); IBaseMapGenerator mapGen = cm; var didConstrain = cm.Constrain(); if (!didConstrain) { Debug.LogWarning("did not constrain"); mapGen = new FallbackMap(bmx, bmy); } for (int x = 0; x < 8; ++x) { for (int y = 0; y < 8; ++y) { var tileIndex = mapGen.GetTileIndex(x, y); Tile tile = Tile.MakeTile(spriteSheet, tileIndex, x, y); MapManager.MapMgrSingleton.SetTile(x, y, tile); } } MapManager.MapMgrSingleton.MakeDistToHomeValues(); //MapManager.MapMgrSingleton.SetGhost (0, Ghost.GhostName.JAMAAL); //MapManager.MapMgrSingleton.SetGhost (0, Ghost.GhostName.LEFTY); //MapManager.MapMgrSingleton.SetGhost (0, Ghost.GhostName.RIGHTY); //MapManager.MapMgrSingleton.SetGhost (0, Ghost.GhostName.BLINKY); //MapManager.MapMgrSingleton.SetGhost (1, Ghost.GhostName.LILBRO); //MapManager.MapMgrSingleton.SetGhost (1, Ghost.GhostName.INTERCEPTOR); //MapManager.MapMgrSingleton.SetGhost (0, Ghost.GhostName.HILBERT); for (int i = 0; i < 4; ++i) { Ghost.GhostName gn = mapGen.GetSelectedGhost(i); Debug.LogFormat("Assigning {0} {1}", i, gn); MapManager.MapMgrSingleton.SetGhost(i, gn); } //Debug.Log ("made distances"); }
Ghost.GhostName PickRandomGhost(System.Random r, int i) { Debug.LogFormat("Picking ghost for slot {0}", i); var startIndex = r.Next(12); Debug.LogFormat("starting with ghost index {0}", startIndex); for (int offset = 0; offset < 12; ++offset) { int candIndex = (startIndex + offset) % 12; Ghost.GhostName candName = IndexToGhostName(candIndex); Debug.LogFormat("checking ghost {0}", candName); if (!IsGhostNameInUse(candName, i)) { Debug.LogFormat("looks good"); return(candName); } } return(Ghost.GhostName.BLINKY); }
internal void SetGhost(int i, Ghost.GhostName name) { _ghostNames [i] = name; }