protected override void LoadContent() { base.LoadContent(); TextureManager.AddTexture("leda-logo", Content.Load <Texture2D>("Textures\\leda-logo")); TextureManager.AddTexture("pixel", Content.Load <Texture2D>("Textures\\WhitePixel")); TextureManager.AddTexture("load-spinner", Content.Load <Texture2D>("Textures\\load-spinner")); }
/// <summary> /// Constructor lets the caller specify whether to include the standard /// "A=ok, B=cancel" usage text prompt. /// </summary> public MessageBoxScreen(string message, bool includeUsageText = false, bool includeCancelOption = false) { _IncludeCancelOption = includeCancelOption; _Gradient_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/gradient")); string usageText = String.Empty; switch (CutlassEngine.CurrentPlatform) { case PlatformID.MacOSX: goto case PlatformID.Win32Windows; case PlatformID.Unix: goto case PlatformID.Win32Windows; case PlatformID.Win32NT: goto case PlatformID.Win32Windows; case PlatformID.Win32S: goto case PlatformID.Win32Windows; case PlatformID.Win32Windows: usageText = "\nSpace, Enter = OK"; if (_IncludeCancelOption) { usageText += "\nEsc = Cancel"; } break; case PlatformID.WinCE: goto case PlatformID.Win32Windows; case PlatformID.Xbox: usageText = "\nSA = OK"; if (_IncludeCancelOption) { usageText += "\nB = Cancel"; } break; default: break; } if (includeUsageText) { this._Message = message + usageText; } else { this._Message = message; } IsPopup = true; TransitionOnTime = TimeSpan.FromSeconds(0.2); TransitionOffTime = TimeSpan.FromSeconds(0.2); }
/// <summary> /// Button Constructor with a specified text and using a texture? /// </summary> public ButtonEntry(string text, bool texture) { this.text = text; this.customTexture = texture; if (texture) { TextureManager.AddTexture("buttontexture", "Misc/ButtonTexture"); } }
/// <summary> /// Loads our chatbar texture /// </summary> public void LoadContent() { if (!initialized) { Initialize(); } TextureManager.AddTexture("ButtonTexture", "Misc/ButtonTexture"); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); textureManager.AddTexture( "title-screen", Content.Load <Texture2D>(@"Backgrounds\title-screen")); textureManager.AddTexture( "blue-button", Content.Load <Texture2D>(@"GUI\g9202")); textureManager.AddTexture( "green-button", Content.Load <Texture2D>(@"GUI\g9236")); textureManager.AddTexture( "grey-button", Content.Load <Texture2D>(@"GUI\g9254")); // TODO: use this.Content to load your game content here }
/// <summary> /// Loads the texture for our background screen /// </summary> public override void LoadContent() { base.LoadContent(); if (custom) { TextureManager.AddTexture(texture, "Misc/gradient"); } else { TextureManager.AddTexture(texture, "Background/background"); } }
private void CreateWorld() { Texture2D tilesetTexture = Game.Content.Load <Texture2D>(@"Tilesets\tileset1"); Tileset tileset1 = new Tileset(tilesetTexture, 8, 8, 32, 32); tilesetTexture = Game.Content.Load <Texture2D>(@"Tilesets\tileset2"); Tileset tileset2 = new Tileset(tilesetTexture, 8, 8, 32, 32); tilesetTexture = Game.Content.Load <Texture2D>(@"Tilesets\fire-tiles"); TextureManager.AddTexture("FullSheet", Game.Content.Load <Texture2D>(@"GUI\ProjectUtumno_full")); TextureManager.AddTexture("SuppSheet", Game.Content.Load <Texture2D>(@"GUI\ProjectUtumno_supplemental")); AnimatedTileset animatedSet = new AnimatedTileset(tilesetTexture, 8, 1, 64, 64); MapLayer layer = new MapLayer(100, 100); for (int y = 0; y < layer.Height; y++) { for (int x = 0; x < layer.Width; x++) { Tile tile = new Tile(0, 0); layer.SetTile(x, y, tile); } } MapLayer splatter = new MapLayer(100, 100); Random random = new Random(); for (int i = 0; i < 100; i++) { int x = random.Next(0, 100); int y = random.Next(0, 100); int index = random.Next(2, 14); Tile tile = new Tile(index, 0); splatter.SetTile(x, y, tile); } splatter.SetTile(5, 0, new Tile(14, 0)); splatter.SetTile(1, 0, new Tile(0, 1)); splatter.SetTile(2, 0, new Tile(2, 1)); splatter.SetTile(3, 0, new Tile(0, 1)); TileMap map = new TileMap(tileset1, animatedSet, layer); map.AddTileset(tileset2); map.AddLayer(splatter); map.CollisionLayer.Collisions.Add(new Point(1, 0), CollisionType.Impassable); map.CollisionLayer.Collisions.Add(new Point(3, 0), CollisionType.Impassable); map.AnimatedTileLayer.AnimatedTiles.Add(new Point(5, 0), new AnimatedTile(0, 8)); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); DataManager.ReadEntityData(Content); DataManager.ReadArmorData(Content); DataManager.ReadShieldData(Content); DataManager.ReadWeaponData(Content); DataManager.ReadChestData(Content); DataManager.ReadKeyData(Content); DataManager.ReadSkillData(Content); FontManager.AddFont("testfont", Content.Load <SpriteFont>("Fonts/scenefont")); TextureManager.AddTexture("FullSheet", Content.Load <Texture2D>("GUI/ProjectUtumno_full")); }
public static void AddPrototype(string prototypeName) { var lines = File.ReadLines($"{prototypeName}/{prototypeName}.txt"); foreach (string line in lines) { if (line[0] != '#') { var elements = line.Split(' '); var typename = elements[0]; TextureManager.AddTexture(typename, $"{prototypeName}/{typename}.png"); prototypes.Add(typename, elements); } } }
/// <summary> /// Load Content /// </summary> public override void LoadContent() { base.LoadContent(); _TitleScrollMiddle_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/titleScrollMiddle")); _TitleScrollEdge_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/titleScrollEdge")); _MenuBackgroundCorner_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/backgroundMenuCorner")); _MenuBackgroundVerticalEdge_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/backgroundMenuVerticalEdge")); _MenuBackgroundHorizontalEdge_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/backgroundMenuHorizontalEdge")); _TitleFont_Id = FontManager.AddFont(new CutlassFont("Content/Fonts/bilboSwashCaps")); SetMenuEntryFont(FontManager.AddFont(new CutlassFont("Content/Fonts/frederickaTheGreat"))); SetMenuEntryTextColor(Palette.CharcoalGrey); SetMenuEntrySelectedTextColor(Palette.LightBlue); }
public Player(GameplayScreen parentScreen, Vector2 position) { _Player_TexId_Standing_R = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-standing-48-120-R")); _Player_TexId_Standing_L = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-standing-48-120-L")); _Player_TexId_Jumping_R = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-jumping-64-120-R")); _Player_TexId_Jumping_L = TextureManager.AddTexture(new CutlassTexture("Content/Sprites/pirate-jumping-64-120-L")); _Player_TexId_Walking_R = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-560-120-R", 10, 5)); _Player_TexId_Walking_L = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-560-120-L", 10, 5)); _Player_TexId_Walking_Reverse_R = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-reverse-560-120-R", 10, 5)); _Player_TexId_Walking_Reverse_L = TextureManager.AddTexture(new CutlassAnimatedTexture("Content/Sprites/pirate-walking-reverse-560-120-L", 10, 5)); _CurrentTexture = _Player_TexId_Walking_R; _ParentScreen = parentScreen; _Active = true; _Position = position; _IsVisible = true; }
public Scenery(Vector2 position, bool isVisible = true, ICutlassTexture texture = null, bool animated = false, CollisionSide side = CollisionSide.All) { _Position = position; _IsVisible = isVisible; _Active = true; if (isVisible && texture != null) { _SceneryObject_Id = TextureManager.AddTexture(texture); _Animated = animated; _Side = side; } else { _Side = CollisionSide.All; } }
private void ThreadedAssetLoader() { // Spin through the attribute list and load based on type foreach (XElement at in _assetsForThreadedLoad.Element("assets").Elements()) { // Expected XML structure is "assets" - "[assettype]s" - "[asset]" foreach (XElement asset in at.Elements()) { switch (at.Name.ToString()) { case "textures": TextureManager.AddTexture(asset.Attribute("name").Value, Game.Content.Load <Texture2D>(asset.Attribute("file").Value)); break; case "music": MusicManager.AddTune(asset.Attribute("name").Value, Game.Content.Load <Song>(asset.Attribute("file").Value)); break; case "sound-effects": if (asset.Attribute("use-instance") != null) { SoundEffectManager.AddEffect( asset.Attribute("name").Value, Game.Content.Load <SoundEffect>(asset.Attribute("file").Value), (bool)asset.Attribute("use-instance")); } else { SoundEffectManager.AddEffect( asset.Attribute("name").Value, Game.Content.Load <SoundEffect>(asset.Attribute("file").Value), false); } break; case "custom": LoadCustomContent(asset); break; } _loadedAssetCount++; } } }
protected override void LoadContent() { if (!TextureManager.ContainsTexture("merchant")) { TextureManager.AddTexture("merchant", GameRef.Content.Load <Texture2D>(@"Backgrounds\merchant-overlay")); } if (!TextureManager.ContainsTexture("scene-background")) { TextureManager.AddTexture("scene-background", GameRef.Content.Load <Texture2D>(@"Scenes\scenebackground")); } _merchantFont = GameRef.Content.Load <SpriteFont>(@"Fonts\Sansation_Light"); _sceneFont = GameRef.Content.Load <SpriteFont>(@"Fonts\Sansation_Light"); _selected = GameRef.Content.Load <Texture2D>(@"Misc\selected"); if (GameScene.Selected == null) { GameScene.Load(GameRef); } base.LoadContent(); }
/// <summary> /// Loads the graphic content for this screen. This uses the shared /// Content Manager provided by the Game Base class. /// </summary> public override void LoadContent() { TextureManager.AddTexture("gradient", "Misc/gradient"); }
/// <summary> /// Loads graphics content for this screen. The background texture is quite /// big, so we use our own local ContentManager to load it. This allows us /// to unload before going from the menus into the game itself, wheras if we /// used the shared ContentManager provided by the Game class, the content /// would remain loaded forever. /// </summary> public override void LoadContent() { base.LoadContent(); _OceanClouds_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/oceanClouds")); }
public static void Init() { // init window Game.Window.SetDefaultOrthographicSize(20f); // add textures TextureManager.AddTexture("Player", new Texture(@"Assets\Player.png")); TextureManager.AddTexture("EnemyBlack2", new Texture(@"Assets\EnemyBlack2.png")); TextureManager.AddTexture("LaserRed01", new Texture(@"Assets\LaserRed01.png")); //add systems engine.AddSystem(new PlayerMoveSystem()); engine.AddSystem(new PlayerShootSystem()); engine.AddSystem(new AISpawnSystem()); engine.AddSystem(new AIMoveSystem()); engine.AddSystem(new DestroyEntityWhenOutOfScreenSystem()); engine.AddSystem(new CollisionDetectionSystem()); engine.AddSystem(new CollisionSolverSystem()); engine.AddSystem(new SpriteRendererSystem()); //create entities & add components #region Player ECSEntity player = engine.CreateEntity(); var halfOrthoSize = Game.Window.CurrentOrthoGraphicSize * 0.5f; engine.AddComponent(player, new NameComponent() { Name = "PLAYER" }); engine.AddComponent(player, new InputReceiverComponent()); engine.AddComponent(player, new PositionComponent() { Position = new Vector2(halfOrthoSize * Window.aspectRatio, halfOrthoSize * 1.5f) }); engine.AddComponent(player, new VelocityComponent() { Velocity = new Vector2(5f, 5f) }); engine.AddComponent(player, new BoxColliderComponent() { Size = new Vector2(1f, 1f) }); engine.AddComponent(player, new SpriteRendererComponent() { RenderOffset = RenderOffset.Player, Texture = TextureManager.GetTexture("Player"), Sprite = new Sprite(1f, 1f) { pivot = Vector2.One * 0.5f } }); engine.AddComponent(player, new WeaponComponent() { BulletSpawnOffset = new Vector2(0f, -1f) }); #endregion #region EnemySpawner(s) int spawnersCount = 5; float step = Game.Window.OrthoWidth / (float)(spawnersCount + 1); float offset = -1f; float minTime = 1f; float maxTime = 3f; for (int i = 0; i < spawnersCount; i++) { var spawner = engine.CreateEntity(); engine.AddComponent(spawner, new NameComponent() { Name = "SPAWNER " + i }); engine.AddComponent(spawner, new SpawnPointComponent() { SpawnPoint = new Vector2(step * (i + 1), offset) }); var time = (float)(minTime + Game.Random.NextDouble() * (maxTime - minTime)); engine.AddComponent(spawner, new TimeComponent() { Time = time, CurrentTime = time }); } #endregion // init engine Game.engine.Init(); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); DataManager.ReadEntityData(Content); DataManager.ReadArmorData(Content); DataManager.ReadShieldData(Content); DataManager.ReadWeaponData(Content); DataManager.ReadChestData(Content); DataManager.ReadKeyData(Content); DataManager.ReadSkillData(Content); FontManager.AddFont("testfont", Content.Load <SpriteFont>("Fonts/scenefont")); TextureManager.AddTexture("FullSheet", Content.Load <Texture2D>("GUI/ProjectUtumno_full")); string[] fileNames = Directory.GetFiles( Path.Combine("Content/Game/Items", "Armor"), "*.xnb"); foreach (string a in fileNames) { string path = "Game/Items/Armor/" + Path.GetFileNameWithoutExtension(a); ArmorData armorData = Content.Load <ArmorData>(path); ItemManager.AddArmor(new Armor(armorData)); } fileNames = Directory.GetFiles( Path.Combine("Content/Game/Items", "Shield"), "*.xnb"); foreach (string a in fileNames) { string path = "Game/Items/Shield/" + Path.GetFileNameWithoutExtension(a); ShieldData shieldData = Content.Load <ShieldData>(path); ItemManager.AddShield(new Shield(shieldData)); } fileNames = Directory.GetFiles( Path.Combine("Content/Game/Items", "Weapon"), "*.xnb"); foreach (string a in fileNames) { string path = "Game/Items/Weapon/" + Path.GetFileNameWithoutExtension(a); WeaponData weaponData = Content.Load <WeaponData>(path); ItemManager.AddWeapon(new Weapon(weaponData)); } PotionData potionData = new PotionData { Name = "Minor Healing Potion", Type = "Potion", Target = "Health", Price = 100, Weight = .25f, Minimum = 6, Maximum = 13, AllowableClasses = new[] { "Fighter", "Wizard", "Rogue", "Priest" } }; Potion potion = new Potion(potionData); ItemManager.AddPotion(potion); potionData = new PotionData { Name = "Minor Mana Potion", Type = "Potion", Target = "Mana", Price = 100, Weight = .25f, Minimum = 6, Maximum = 13, AllowableClasses = new[] { "Wizard", "Priest" } }; potion = new Potion(potionData); ItemManager.AddPotion(potion); potionData = new PotionData { Name = "Minor Stamina Potion", Type = "Potion", Target = "Stamina", Price = 100, Weight = .25f, Minimum = 6, Maximum = 13, AllowableClasses = new[] { "Fighter", "Rogue" } }; potion = new Potion(potionData); ItemManager.AddPotion(potion); GameItemManager.AddItem("Long Sword", new GameItem(ItemManager.GetWeapon("Long Sword"), "FullSheet", new Rectangle(1696, 1408, 32, 32))); GameItemManager.AddItem("Short Sword", new GameItem(ItemManager.GetWeapon("Short Sword"), "FullSheet", new Rectangle(800, 1504, 32, 32))); GameItemManager.AddItem("Apprentice Staff", new GameItem(ItemManager.GetWeapon("Apprentice Staff"), "FullSheet", new Rectangle(224, 1408, 32, 32))); GameItemManager.AddItem("Acolyte Staff", new GameItem(ItemManager.GetWeapon("Acolyte Staff"), "FullSheet", new Rectangle(256, 1408, 32, 32))); GameItemManager.AddItem("Leather Armor", new GameItem(ItemManager.GetArmor("Leather Armor"), "FullSheet", new Rectangle(1248, 1216, 32, 32))); GameItemManager.AddItem("Chain Mail", new GameItem(ItemManager.GetArmor("Chain Mail"), "FullSheet", new Rectangle(1472, 1184, 32, 32))); GameItemManager.AddItem("Studded Leather Armor", new GameItem(ItemManager.GetArmor("Studded Leather Armor"), "FullSheet", new Rectangle(1984, 1120, 32, 32))); GameItemManager.AddItem("Light Robes", new GameItem(ItemManager.GetArmor("Light Robes"), "FullSheet", new Rectangle(992, 1216, 32, 32))); GameItemManager.AddItem("Medium Robes", new GameItem(ItemManager.GetArmor("Medium Robes"), "FullSheet", new Rectangle(1024, 1216, 32, 32))); GameItemManager.AddItem("Minor Healing Potion", new GameItem(ItemManager.GetPotion("Minor Healing Potion"), "FullSheet", new Rectangle(832, 1344, 32, 32))); GameItemManager.AddItem("Minor Mana Potion", new GameItem(ItemManager.GetPotion("Minor Mana Potion"), "FullSheet", new Rectangle(576, 1344, 32, 32))); GameItemManager.AddItem("Minor Stamina Potion", new GameItem(ItemManager.GetPotion("Minor Stamina Potion"), "FullSheet", new Rectangle(704, 1344, 32, 32))); }
/// <summary> /// Update the state of the screen. /// </summary> /// <param name="gameTime">Current time of the game.</param> /// <param name="otherScreenHasFocus">true if other screen has the focus, false otherwise.</param> /// <param name="coveredByOtherScreen">true if other screen cover this screen, false otherwise.</param> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); _safeTime += gameTime.ElapsedGameTime.Milliseconds; if (_resources.Count != 0) { string resource = _resources[0]; string[] information = resource.Split('_'); if (information[1] == "Texture") { if (_create) { ThreadStart threadStarter = delegate { TextureManager.AddTexture(information[0], new GameTexture("Content/Textures/" + information[0])); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else { ThreadStart threadStarter = delegate { TextureManager.RemoveTexture(information[0]); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } _loadedResources.Add(resource); _resources.Remove(resource); } else if (information[1] == "Model") { if (_create) { ThreadStart threadStarter = delegate { ModelManager.AddModel(information[0], new GameModel("Content/Models/" + information[0])); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else { ThreadStart threadStarter = delegate { ModelManager.RemoveModel(information[0]); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } _loadedResources.Add(resource); _resources.Remove(resource); } else if (information[1] == "Sound") { if (_create) { ThreadStart threadStarter = delegate { SoundManager.AddSound(information[0], new GameSound("Content/Sounds/" + information[0])); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else { ThreadStart threadStarter = delegate { SoundManager.RemoveSound(information[0]); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } _loadedResources.Add(resource); _resources.Remove(resource); } else { if (_create) { foreach (string loadedResource in _loadedResources) { try { string[] loadedInformation = loadedResource.Split('_'); if (loadedInformation[1] == "Model" && ModelManager.GetModel(loadedInformation[0]).Model.Meshes == null) { throw new Exception(); } else if (loadedInformation[1] == "Texture" && TextureManager.GetTexture(loadedInformation[0]).BaseTexture.IsDisposed) { throw new Exception(); } else if (loadedInformation[1] == "Sound" && SoundManager.GetSound(loadedInformation[0]).GameSoundEffect.IsDisposed) { throw new Exception(); } } catch (Exception e) { return; } } ThreadStart threadStarter = delegate { LevelManager.AddLevel(resource, new Scene.SceneRenderer( FileHelper.readMapInformation(resource))); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else { ThreadStart threadStarter = delegate { LevelManager.RemoveLevel(resource); _numberOfLoadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } _loadedResources.Add(resource); _resources.Remove(resource); } } if (_numberOfLoadedResources >= _totalResources - 1) { EngineManager.Game.IsFixedTimeStep = false; if (_create) { ScreenManager.RemoveScreen("LoadingScreen"); ScreenManager.AddScreen("ContinueGame", new MainGameScreen( "ContinueGame", _mapName, _mapInformation, _savedGame)); } else if (_safeTime > totalSafeTime) { ScreenManager.RemoveScreen("LoadingScreen"); EngineManager.Loader.Unload(); ScreenManager.RemoveScreen("LoadingScreen"); ScreenManager.AddScreen("Background", new BackgroundScreen("Background")); ScreenManager.AddScreen("MainMenu", new MainMenuScreen("MainMenu")); } } }
/// <summary> /// Load and calculate all the necessary content of the game. /// </summary> public override void Load() { base.Load(); // Set the camera CameraManager.AddCamera(CameraManager.DefaultCamera, new TargetCamera(new Vector3(0, 0, 70), new Vector3(0, 0, 0))); CameraManager.SetActiveCamera(CameraManager.DefaultCamera); // Create the post processing elements renderCapture = new RenderCapture(); postProcessor = new GaussianBlur(10);//2f); // Load all needed textures TextureManager.AddTexture(backgroundTexture, new GameTexture("Content/Textures/MenuBackground", true)); TextureManager.AddTexture("DeadBackground", new GameTexture("Content/Textures/DeadBackground", true)); TextureManager.AddTexture("SeparationBar", new GameTexture("Content/Textures/SeparationBar", true)); TextureManager.AddTexture("SelectedMenuEntry", new GameTexture("Content/Textures/SelectedMenuEntry", true)); TextureManager.AddTexture("DummyTexture15T", new GameTexture("Content/Textures/DummyTexture15T", true)); TextureManager.AddTexture("DummyTexture", new GameTexture("Content/Textures/DummyTexture", true)); TextureManager.AddTexture("BarTexture", new GameTexture("Content/Textures/BarTexture", true)); TextureManager.AddTexture("DialogBackground", new GameTexture("Content/Textures/DialogBackground", true)); TextureManager.AddTexture("EasyDifficult", new GameTexture("Content/Textures/EasyDifficult", true)); TextureManager.AddTexture("NormalDifficult", new GameTexture("Content/Textures/NormalDifficult", true)); TextureManager.AddTexture("HardDifficult", new GameTexture("Content/Textures/HardDifficult", true)); TextureManager.AddTexture("LoadingBackground", new GameTexture("Content/Textures/LoadingBackground", true)); // Load all needed sounds SoundManager.AddSound("Menu", new GameSound("Content/Sounds/Menu", true)); SoundManager.GetSound("Menu").Volume = GameSettings.DefaultInstance.MusicVolume; SoundManager.GetSound("Menu").Play(true, true); SoundManager.AddSound("MenuSelect", new GameSound("Content/Sounds/MenuSelect", true)); SoundManager.GetSound("MenuSelect").Volume = GameSettings.DefaultInstance.SoundVolume; SoundManager.AddSound("MenuAccept", new GameSound("Content/Sounds/MenuAccept", true)); SoundManager.GetSound("MenuAccept").Volume = GameSettings.DefaultInstance.SoundVolume; // Load all needed models ModelManager.AddModel(spacecraftModel, new GameModel("Content/Models/Spacecraft", true)); ModelManager.AddModel("AnimatedMonster", new GameModel("Content/Models/AnimatedMonster", true)); _model = new DrawableModel((GameModel)ModelManager.GetModel(spacecraftModel), new Vector3(-10, 20, 0), new Vector3(-45, 120, 0), new Vector3(1.25f, 1.25f, 1.25f), 0); // Fix the animation elements _animationRing1 = new ObjectAnimation(Vector3.Zero, Vector3.Zero, _model.Rotation, _model.Rotation + new Vector3(0, MathHelper.TwoPi, 0), TimeSpan.FromSeconds(1f), true); _animationRing2 = new ObjectAnimation(Vector3.Zero, Vector3.Zero, _model.Rotation + new Vector3(0, MathHelper.Pi, 0), _model.Rotation + new Vector3(0, MathHelper.TwoPi + MathHelper.Pi, 0), TimeSpan.FromSeconds(1f), true); _individualTransformations.Add("polySurface26", Matrix.CreateScale(_animationRing1.Scale) * Matrix.CreateRotationX(_animationRing1.Rotation.X) * Matrix.CreateRotationY(_animationRing1.Rotation.Y) * Matrix.CreateRotationZ(_animationRing1.Rotation.Z) * Matrix.CreateTranslation(_animationRing1.Position)); _individualTransformations.Add("polySurface27", Matrix.CreateScale(_animationRing2.Scale) * Matrix.CreateRotationX(_animationRing2.Rotation.X) * Matrix.CreateRotationY(_animationRing2.Rotation.Y) * Matrix.CreateRotationZ(_animationRing2.Rotation.Z) * Matrix.CreateTranslation(_animationRing2.Position)); }
/// <summary> /// Load Content. /// </summary> protected override void LoadContent() { base.LoadContent(); _Blank_Id = TextureManager.AddTexture(new CutlassTexture("Content/Textures/blank")); }
/// <summary> /// Loads our texture content /// </summary> public override void LoadContent() { base.LoadContent(); TextureManager.AddTexture(texture, "Textures/ZoneList"); }
private static void InitializeAnimations() { TextureManager.AddTexture("characterSet", "characterSet.png"); AnimationManager.LoadAnimations("textures.txt"); }
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); _safeTime += gameTime.ElapsedGameTime.Milliseconds; if (_state == false) { if (_removableResources.Count != 0) { string resource = _removableResources[0]; string[] information = resource.Split('_'); if (information[1] == "Texture") { ThreadStart threadStarter = delegate { TextureManager.RemoveTexture(information[0]); _releasedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else if (information[1] == "Model") { ThreadStart threadStarter = delegate { ModelManager.RemoveModel(information[0]); _releasedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else if (information[1] == "Sound") { ThreadStart threadStarter = delegate { SoundManager.RemoveSound(information[0]); _releasedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } _removableResources.Remove(resource); } else { _state = true; } } else { if (_loadableResources.Count != 0) { string resource = _loadableResources[0]; string[] information = resource.Split('_'); if (information[1] == "Texture") { ThreadStart threadStarter = delegate { TextureManager.AddTexture(information[0], new GameTexture("Content/Textures/" + information[0])); _loadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else if (information[1] == "Model") { ThreadStart threadStarter = delegate { ModelManager.AddModel(information[0], new GameModel("Content/Models/" + information[0])); _loadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } else if (information[1] == "Sound") { ThreadStart threadStarter = delegate { SoundManager.AddSound(information[0], new GameSound("Content/Sounds/" + information[0])); _loadedResources++; }; Thread addResourceThread = new Thread(threadStarter); addResourceThread.Start(); } _loadableResources.Remove(resource); } } if (_releasedResources >= _totalReleasablesResources - 1 && _loadedResources >= _totalLoadableResources - 1 && _safeTime > totalSafeTime) { ScreenManager.RemoveScreen("LoadScene"); ScreenManager.AddScreen("ContinueGame", new MainGameScreen(this.GameGraphicsDevice, "ContinueGame", _mapInformation)); } }
private static void InitializeTextures() { TextureManager.AddTexture("characterSet", "characterSet.png"); }