/// <summary> /// Initialises the necessary parts of the Simulation /// </summary> protected override void Initialize() { base.Initialize(); this.IsMouseVisible = true; theWorld = null; state = new InitialisationState(); }
/// <summary> /// Sets up the drawer, getting the font and spritebatch from the Display class and initialising the MenuButton /// </summary> /// <param name="option">The SimulationState that this object is in charge of drawing</param> public SingleStringDrawer(SimulationState state) { this.state = state; font = Display.getFont(); batch = Display.getSpriteBatch(); }
/// <summary> /// Restarts and regenerates the world and creatures by returning to the initialisation state /// </summary> public static void restart() { state = new InitialisationState(); currentGeneration = 1; currentRoundTime = 0; }
/// <summary> /// Resumes the world updating, and returns to the world state from the menu /// </summary> public static void resume() { state = theWorld; }
/// <summary> /// Transitions to the options menu state /// </summary> public static void options() { state = new OptionsState(); }
/// <summary> /// Calls when the judging state finishes judging, and adds the next set of creatures to the world after it is reset /// </summary> /// <param name="creatureList">The list of creatures the judging state has created</param> public static void judgingDone(List<Creature> creatureList) { theWorld.reset(creatureList); state = theWorld; currentRoundTime = 0; currentGeneration++; }
/// <summary> /// Transitions to the judging state, getting the necessary input from the world and initialising the judging state /// </summary> public static void judge() { WorldState w = theWorld; state = new JudgingState(w.getLiveCreatures(), w.getDeadCreatures()); }
/// <summary> /// Transitions to the main menu state /// </summary> public static void goToMenu() { state = new MainMenuState(); }
/// <summary> /// Begins the world state simulation, generating a new world and setting it to the current state /// </summary> /// <param name="creatureList">The list of creatures to add to the new world</param> /// <param name="seed">The seed of the random number generator to add to the world</param> public static void begin(List<Creature> creatureList, int seed) { theWorld = new WorldState(seed, creatureList); state = theWorld; }