void ReadUW2AssocFile(int CritterToLoad) { char[] assoc; char[] pgmp; char[] cran; //Load the assoc file long AssocAddressPtr = 0; if ( (DataLoader.ReadStreamFile(BasePath + "CRIT" + sep + "AS.AN", out assoc)) && (DataLoader.ReadStreamFile(BasePath + "CRIT" + sep + "PG.MP", out pgmp)) && (DataLoader.ReadStreamFile(BasePath + "CRIT" + sep + "CR.AN", out cran)) ) { for (int ass = 0; ass <= 63; ass++) { int FileID = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); int auxPal = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); if (FileID != 255) { if (ass == CritterToLoad) { critter = new CritterInfo(FileID, GameWorldController.instance.palLoader.Palettes[0], auxPal, assoc, pgmp, cran); } } } } }
/**************************************/ void ReadUW2AssocFile() { char[] pgmp; char[] cran; pal.LoadPalettes(); //Load the assoc file long AssocAddressPtr = 0; if ( (DataLoader.ReadStreamFile(pathToAssocUW2File, out assoc)) && (DataLoader.ReadStreamFile(pathToPGMPFile, out pgmp)) && (DataLoader.ReadStreamFile(pathToCRANFile, out cran)) ) { for (int ass = 0; ass <= 63; ass++) { int FileID = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); int auxPal = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); if (FileID != 255) { critters[ass] = new CritterInfo(FileID, pal.Palettes[0], auxPal, assoc, pgmp, cran); } } } }
public CritterInfo critter; // =new CritterInfo[64]; public CritLoader(int CritterToLoad) { //pal.LoadPalettes(); //Load the assoc file string assocpath; switch (_RES) { case GAME_UW2: ReadUW2AssocFile(CritterToLoad); return; case GAME_UWDEMO: assocpath = "CRIT" + sep + "DASSOC.ANM"; break; default: assocpath = "CRIT" + sep + "ASSOC.ANM"; break; } char[] assoc; long AssocAddressPtr = 256; if (DataLoader.ReadStreamFile(BasePath + assocpath, out assoc)) { for (int ass = 0; ass <= 63; ass++) { int FileID = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); int auxPal = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); if (ass == CritterToLoad) { critter = new CritterInfo(FileID, GameWorldController.instance.palLoader.Palettes[0], auxPal); } } } }
public new Action getMove(CritterInfo info) { if (info.getFront() == Neighbor.OTHER) { return(Action.INFECT); } else { return(Action.LEFT); } }
public void Register(string id, CritterInfo info) { CritterData existing; if (!infoMap.TryGetValue(id, out existing)) { infoMap.Add(id, new CritterData(info)); } else if (info != existing.info) { Debug.LogErrorFormat("Tried to register two different info blocks to the same ID ({0})", id); } }
// returns the move to be made by the giant public override Action getMove(CritterInfo info) { if (info.getFront() == Neighbor.OTHER) { return(Action.INFECT); } else if (info.getFront() != Neighbor.EMPTY) { return(Action.RIGHT); } else { return(Action.HOP); } }
// returns the move to be made by the bear public override Action getMove(CritterInfo info) { Console.WriteLine(info.getInfectCount() + " Bear "); if (info.getFront() == Neighbor.OTHER) { return(Action.INFECT); } else if (info.getFront() == Neighbor.EMPTY) { return(Action.HOP); } else { return(Action.LEFT); } }
private void ReadUw1AssocFile(int CritterToLoad, string assocpath) { char[] assoc; long AssocAddressPtr = 256; if (DataLoader.ReadStreamFile(BasePath + assocpath, out assoc)) { for (int ass = 0; ass <= 63; ass++) { int FileID = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); int auxPal = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); if (ass == CritterToLoad) { critter = new CritterInfo(FileID, GameWorldController.instance.palLoader.Palettes[0], auxPal); } } } }
void ReadAssocFile() { pal.LoadPalettes(); //Load the assoc file long AssocAddressPtr = 256; if (DataLoader.ReadStreamFile(pathToAssocFile, out assoc)) { for (int ass = 0; ass <= 63; ass++) { int FileID = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); int auxPal = (int)DataLoader.getValAtAddress(assoc, AssocAddressPtr++, 8); if (ass == 3) { critters[ass] = new CritterInfo(FileID, pal.Palettes[0], auxPal); } } } }
public CritterData(CritterInfo info) { this.info = info; this.foundDead = 0; this.foundAlive = 0; }
// This method should be overriden (default action is turning left) public virtual Action getMove(CritterInfo info) { return(Action.LEFT); }
public new Action getMove(CritterInfo info) { return(Action.INFECT); }