private void Awake() { if (s_Instance != null && s_Instance != this) { Destroy(this.gameObject); } else { s_Instance = this; } }
/// <summary> /// Creates and initializes a World. /// </summary> /// <param name="graphicsDevice">The GraphicsDevice from Game class.</param> /// <param name="size">Size of the world.</param> public World(GraphicsDevice graphicsDevice, Point size) { this.graphicsDevice = graphicsDevice; terrain = new Terrain(graphicsDevice, size.X, size.Y); backgroundTerrain = new Terrain(graphicsDevice, size.X, size.Y); gameObjects = new HashSet <IGameObject>(); var terrainTheme = new TerrainTheme { DistanceBetweenBorderReads = 10, DistanceBetweenBorders = 23, BorderOffsetTerrain = new Point(0, -5), BorderTextureLocation = "h3", OffsetBetweenBorders = 1, FillTileLocation = "grassCenter" }; worldGenerator = new TerrainGenerator(backgroundTerrain, graphicsDevice, terrainTheme); }