/// <summary> /// The constructor for worldManager. /// </summary> /// <param name="worldOptions">The options for the world configuration.</param> public WorldManager(WorldOptions worldOptions) { WorldOptions = worldOptions; ChunkMap = new Chunk[WorldOptions.WorldChunkWidth, WorldOptions.WorldChunkHeight]; ChunkIndex = new Dictionary <string, Chunk>(); _worldGenerator = worldOptions.WorldGenerator?.Invoke(WorldOptions); }
public void OnValidate() { P_Options = physicsoptions; G_Options = gameOptions; S_Options = scoreOptions; I_Options = inputOptions; M_Options = menuOptions; W_Options = worldOptions; }
//------------------------------------------------------------------- // Reads a char array mario world along with some worldoptions and stores // it in a buffer. // M: char[,] the world to be read in // W: char[,] reference to the buffer to store the world // Opt: WorldOptions options with which to apply to the world //------------------------------------------------------------------- public static void ReadWorld(char[,] M, ref char[,] W, WorldOptions Opt) { //Console.WriteLine("Reading the world"); //MapBuffer M; int x; //Move(Opt, Buffers.Options, Buffers.Options.SizeOf()); Buffers.Options = Opt; //M = Map; //FillChar(W, W.size(), ' '); for (int i = 0; i < W.GetLength(0); i++) { for (int j = 0; j < W.GetLength(1); j++) { W[i, j] = ' '; } } for (int i = 0; i < EX; i++) { for (int j = 0; j < NV + EY2 + EY1; j++) { W[i, j] = '@'; } } x = 0; while (M[x, 0] != (0) && (x < MaxWorldSize)) { for (int i = 0; i < NV; i++) { W[x, NV - i] = (char)M[x, i]; } W[x, W.GetLength(1) - EY1] = (char)(0); for (int i = 0; i < EY2 + EY1; i++) { W[x, NV + i] = W[x, NV - 1]; } x++; } Buffers.Options.XSize = x; for (int i = x; i < x + EX; i++) { for (int j = 0; j < (NV + EY2 + EY1); j++) { W[i, j] = '@'; } } }
public FakeCustomWorldBootstrap( List <CustomWorldBootstrap.WorldOption> worldOptions = null, bool createDefaultWorld = true, string defaultWorldName = "") { if (worldOptions != null) { WorldOptions.AddRange(worldOptions); } CreateDefaultWorld = createDefaultWorld; DefaultWorldName = defaultWorldName; }
//------------------------------------------------------------------- // Will change the WorldOptions of a single world so that the world // does not change. //------------------------------------------------------------------- public static void Swap() { WorldOptions TempOptions; byte C; TempOptions = Options; Options = SaveOptions; SaveOptions = TempOptions; for (int i = EX; i < MaxWorldSize - 1 + EX; i++) { for (int j = EY1; j < NV - 1 + EY2; j++) { C = (byte)WorldMap[i, j]; WorldMap[i, j] = SaveWorldMap[i, j]; SaveWorldMap[i, j] = (char)C; } } }
/// <summary> /// Constructs a simulation /// </summary> /// <param name="gameMode"></param> /// <param name="worldOptions">Given world options that is given to the world manager</param> /// <param name="tickSpeed">A optional parameter used for indicating the ticks per second. (20tps is the default)</param> public Simulation(SimulationGameMode gameMode, WorldOptions worldOptions, int tickSpeed = 20) { _lock = new object(); GameMode = gameMode; _state = SimulationState.Shutdown; _tickSpeed = 1000 / tickSpeed; _random = new Random(); Tick = 0; ConnectedClients = 0; World = new WorldManager(worldOptions); SimulationDistance = 3; //entities _entitiesIndex = new Dictionary <string, SimulationEntity>(); _playerEntitiesIndex = new Dictionary <string, SimulationEntity>(); TileComponentManager.LoadTileComponents(); }
/// <summary> /// Generates a remote world. /// </summary> /// <param name="options">Options used to generate the world.</param> public RemoteWorld(WorldOptions options) : base(options) { }
/// <summary> /// The generator of the world. /// </summary> /// <param name="options">The options used for the world generation.</param> protected WorldGenerator(WorldOptions options) { WorldOptions = options; }
public TileGenerator(WorldOptions options) { this._options = options; }
//------------------------------------------------------------------- // Will change the WorldOptions of a single world so that the world // does not change. //------------------------------------------------------------------- public static void Swap() { WorldOptions TempOptions; byte C; TempOptions = Options; Options = SaveOptions; SaveOptions = TempOptions; for (int i = EX; i < MaxWorldSize - 1 + EX; i++) for (int j = EY1; j < NV -1 + EY2; j++) { C = (byte)WorldMap[i,j]; WorldMap[i, j] = SaveWorldMap[i, j]; SaveWorldMap[i,j] = (char)C; } }
//------------------------------------------------------------------- // Reads a char array mario world along with some worldoptions and stores // it in a buffer. // M: char[,] the world to be read in // W: char[,] reference to the buffer to store the world // Opt: WorldOptions options with which to apply to the world //------------------------------------------------------------------- public static void ReadWorld(char[,] M, ref char[,] W, WorldOptions Opt) { //Console.WriteLine("Reading the world"); //MapBuffer M; int x; //Move(Opt, Buffers.Options, Buffers.Options.SizeOf()); Buffers.Options = Opt; //M = Map; //FillChar(W, W.size(), ' '); for (int i = 0; i < W.GetLength(0); i++) for (int j = 0; j < W.GetLength(1); j++) W[i,j] = ' '; for (int i = 0; i < EX; i++) for (int j = 0; j < NV + EY2 + EY1; j++) W[i,j] = '@'; x = 0; while (M[x,0] != (0) && (x < MaxWorldSize)) { for (int i = 0; i < NV; i++) W[x, NV - i] = (char)M[x, i]; W[x, W.GetLength(1) - EY1] = (char)(0); for (int i = 0; i < EY2 + EY1; i++) W[x, NV + i] = W[x, NV - 1]; x++; } Buffers.Options.XSize = x; for (int i = x; i < x + EX; i++) for (int j = 0; j < (NV + EY2 + EY1); j++) W[i, j] = '@'; }