public TextureHolder GenerateTextures(TexturesGenerationMode mode, int[] resolutions) { TextureHolder newTextureHolder = new TextureHolder(); Color mainColor = Utils.GenerateRandomColor(Color.white); Color secondColor = Utils.GenerateRandomColor(mainColor); newTextureHolder.mainColor = mainColor; newTextureHolder.secondColor = secondColor; switch (mode) { case TexturesGenerationMode.LinearRamp: { for (int i = 0; i < resolutions.Length; i++) { newTextureHolder.AddTexture(GetLinearRampTexture(resolutions[i], mainColor, secondColor)); } break; } case TexturesGenerationMode.CircularRamp: { for (int i = 0; i < resolutions.Length; i++) { newTextureHolder.AddTexture(GetCircularRampTexture(resolutions[i], mainColor, secondColor)); } break; } } return(newTextureHolder); }
/// <summary> /// Loads in all textures for this state. /// </summary> private void LoadTextures() { TextureHolder.AddTexture("player", _game.Content.Load <Texture2D>("player")); TextureHolder.AddTexture("explosion", _game.Content.Load <Texture2D>("explosion1")); TextureHolder.AddTexture("bullet_light", _game.Content.Load <Texture2D>("bullet_light")); TextureHolder.AddTexture("bullet_medium", _game.Content.Load <Texture2D>("bullet_medium")); TextureHolder.AddTexture("bullet_heavy", _game.Content.Load <Texture2D>("bullet_heavy")); TextureHolder.AddTexture("meteor_tiny", _game.Content.Load <Texture2D>("meteor_tiny")); TextureHolder.AddTexture("meteor_small", _game.Content.Load <Texture2D>("meteor_small")); TextureHolder.AddTexture("meteor_medium", _game.Content.Load <Texture2D>("meteor_med")); TextureHolder.AddTexture("meteor_big", _game.Content.Load <Texture2D>("meteor_big")); TextureHolder.AddTexture("planet_blue", _game.Content.Load <Texture2D>("planet_blue")); TextureHolder.AddTexture("planet_brown", _game.Content.Load <Texture2D>("planet_brown")); TextureHolder.AddTexture("planet_red", _game.Content.Load <Texture2D>("planet_red")); TextureHolder.AddTexture("healthbar", _game.Content.Load <Texture2D>("healthbar")); }
protected override void LoadContent() { //Initialize the GameInfo: GameInfo.RefSpriteBatch = spriteBatch; GameInfo.RefDevice = Device; GameInfo.RefDeviceManager = graphics; GameInfo.RefContent = Content; //Initialize some more static classes: TextureHolder.Initialize(); SoundHolder.Initialize(); MouseManager.Initialize(); //Initalize the grid: Grid grid = new Grid(new Vector2(0, 0), 100, 40); Grid gridFloor = new Grid(new Vector2(0, 0), 100, 40); ObjectHolder.Create(grid); ObjectHolder.Create(gridFloor); //Initialize the camera: Camera.Initialize(new Vector2(0, 0)); //Initialize default sprites: TextureHolder.DefaultTextures[typeof(DungeonWall)] = TextureHolder.AddTexture("DungeonWall"); TextureHolder.DefaultTextures[typeof(DungeonFloor)] = TextureHolder.AddTexture("DungeonFloor"); TextureHolder.DefaultTextures[typeof(DungeonFloor2)] = TextureHolder.AddTexture("DungeonFloor2"); TextureHolder.DefaultTextures[typeof(Player)] = TextureHolder.AddTexture("Player"); TextureHolder.DefaultTextures[typeof(PlayerLegs)] = TextureHolder.AddTexture("PlayerLegs"); TextureHolder.DefaultTextures[typeof(PlayerSword)] = TextureHolder.AddTexture("PlayerSword"); TextureHolder.DefaultTextures[typeof(CannonBot)] = TextureHolder.AddTexture("CannonBot"); TextureHolder.DefaultTextures[typeof(Sink)] = TextureHolder.AddTexture("Sink"); //Load sounds: //Create game objects: gridFloor.CreateFromString( //Make the floor new Dictionary <char, Type>() { { 'f', typeof(DungeonFloor) }, { 's', typeof(DungeonFloor2) }, { '.', null } }, new Dictionary <char, GameObject>() { }, new string[] { "..............", ".sfffffffffff.", ".ffffffffffff.", ".ffffffffffff..........", ".fffffffffffffffsfffff.", ".fffffffsfffffffffffff.", ".fffffffffffffffffffff.", ".fffffffffffffffffffff.", ".ffffffffffff..........", ".fffsffffffff.", ".ffffffffffff.", ".............." }); grid.CreateFromString( new Dictionary <char, Type>() { { 'w', typeof(DungeonWall) }, { 'p', typeof(Player) }, { 'c', typeof(CannonBot) }, { 's', typeof(Sink) }, { '.', null } }, new Dictionary <char, GameObject>() { { '1', new Sink(new Vector2(0, 0), MazeGameEngine.FurnitureDirection.Up) } }, new string[] { "wwwwwwwwwwwwww", "w............w", "w............w", "w............wwwwwwwwww", "w.....................w", "w.....p...............w", "w.....................w", "w.....................w", "w............wwwwwwwwww", "w............w", "w.....1......w", "wwwwwwwwwwwwww" }); //Make a reference to the UI objects: (so that other objects can interact with them) }