public static void InitializeAllContentLoaders(ContentManager content) { TextureLoader.Initialize(content); FontLoader.Initialize(content); CharmLoader.Initialize(content); CreatureLoader.Initialize(content); ProjectileLoader.Initialize(content); ShieldLoader.Initialize(content); TileLoader.Initialize(content); UserInterfaceLoader.Initialize(content); WeaponLoader.Initialize(content); }
public EnemyFactory(Pathfinding pathfinder) { creatureLoader = CreatureLoader.GetInstance(); weaponFactory = ItemFactoryContainer.Weapons; shieldFactory = ItemFactoryContainer.Shields; charmFactory = ItemFactoryContainer.Charms; this.pathfinder = pathfinder; healthBarSprite = creatureLoader.Get("healthBar1"); }
public Compiler() { _loaders[typeof(TileSet)] = new TileSetLoader(); _loaders[typeof(Map)] = new MapLoader(); _loaders[typeof(Dungeon)] = new DungeonLoader(); _loaders[typeof(TileInfo)] = new TileInfoLoader(); _loaders[typeof(TileObject)] = new TileObjectLoader(); _loaders[typeof(CreatureInfo)] = new CreatureLoader(); _loaders[typeof(BaseItemInfo)] = new ItemLoader(); _loaders[typeof(Class)] = new ClassLoader(); _loaders[typeof(BaseGenerator)] = new GeneratorLoader(); _loaders[typeof(AbilityInfo)] = new AbilityLoader(); }
private void OnInject2Clicked(object sender, EventArgs e) { Incubator incubator = new Incubator(); byte[] dna = CreatureLoader.Load(); if (dna != null) { _currentEvaluator.RequestInjection(dna, 1); _lastFittest2 = incubator.Incubate(dna); UpdateCreature2Details(); } }
public TradeScreen(OnScreenChanged screenChanged, TradeScreenContents tradeContents) : base(screenChanged) { UserInterfaceLoader uiLoader = UserInterfaceLoader.GetInstance(); FontLoader fontLoader = FontLoader.GetInstance(); CreatureLoader creatureLoader = CreatureLoader.GetInstance(); TradeContents = tradeContents; saveGameOverrideEnabled = false; tradeItemBoxes = new List <ItemBox>(); tradeItemBoxBackgrounds = new List <StaticEntity>(); level = tradeContents.Level; Health = tradeContents.Health; oldHealth = Health; weapon1 = tradeContents.Weapon1; weapon2 = tradeContents.Weapon2; shield1 = tradeContents.Shield1; charm1 = tradeContents.Charm1; oldWeapon1 = weapon1; oldWeapon2 = weapon2; oldShield1 = shield1; oldCharm1 = charm1; actionBarBackground = uiLoader.Get("blankBackground"); background = new StaticEntity("Background", new Vector2(GameConstants.WINDOW_WIDTH / 2, GameConstants.WINDOW_HEIGHT / 2), actionBarBackground); playButton = new StaticEntity("Play Button", new Vector2(GameConstants.WINDOW_WIDTH - GameConstants.TILE_SIZE * 5 / 2, GameConstants.WINDOW_HEIGHT - GameConstants.TILE_SIZE), uiLoader.Get("continue")); //TODO: Remove font = fontLoader.Get("font"); healthBarSprite = creatureLoader.Get("healthBar1"); playerTradeMenuHealth = new HealthBar("Trade Menu Health", new Vector2(GameConstants.TILE_SIZE, GameConstants.WINDOW_HEIGHT - (GameConstants.TILE_SIZE * 3 + 15)), healthBarSprite); Vector2 firstBoxLocation = new Vector2(GameConstants.TILE_SIZE / 2 + GameConstants.TILE_SIZE * 1, GameConstants.TILE_SIZE * 3); Vector2 secondBoxLocation = new Vector2(GameConstants.TILE_SIZE / 2 + GameConstants.TILE_SIZE * 3, GameConstants.TILE_SIZE * 3); Vector2 thirdBoxLocation = new Vector2(GameConstants.TILE_SIZE / 2 + GameConstants.TILE_SIZE * 5, GameConstants.TILE_SIZE * 3); Vector2 fourthBoxLocation = new Vector2(GameConstants.TILE_SIZE / 2 + GameConstants.TILE_SIZE * 7, GameConstants.TILE_SIZE * 3); Vector2 fifthBoxLocation = new Vector2(GameConstants.TILE_SIZE / 2 + GameConstants.TILE_SIZE * 9, GameConstants.TILE_SIZE * 3); equippedItemBoxBackgrounds = new List <StaticEntity>(); equippedItemBoxes = new List <ItemBox>(); int equipBoxX = (int)(GameConstants.TILE_SIZE * 1.5); int equipBoxY = (int)(GameConstants.WINDOW_HEIGHT - GameConstants.TILE_SIZE * 2.5); Vector2 box1Location = new Vector2(equipBoxX, equipBoxY); equippedItemBoxes.Add(new ItemBox("Weapon1", box1Location, weapon1.Sprite, weapon1)); equippedItemBoxBackgrounds.Add(new StaticEntity("Weapon1", box1Location, actionBarBackground)); Vector2 box2Location = new Vector2(equipBoxX + GameConstants.TILE_SIZE * 1, equipBoxY); equippedItemBoxes.Add(new ItemBox("Weapon2", box2Location, weapon2.Sprite, weapon2)); equippedItemBoxBackgrounds.Add(new StaticEntity("Weapon2", box2Location, actionBarBackground)); Vector2 box3Location = new Vector2(equipBoxX + GameConstants.TILE_SIZE * 2, equipBoxY); equippedItemBoxes.Add(new ItemBox("Shield1", box3Location, shield1.Sprite, shield1)); equippedItemBoxBackgrounds.Add(new StaticEntity("Shield1", box3Location, actionBarBackground)); Vector2 box4Location = new Vector2(equipBoxX + GameConstants.TILE_SIZE * 3, equipBoxY); equippedItemBoxes.Add(new ItemBox("Charm1", box4Location, charm1.Sprite, charm1)); equippedItemBoxBackgrounds.Add(new StaticEntity("Charm1", box4Location, actionBarBackground)); //TODO: Rewrite once items inheritance is sorted out List <Item> items = new List <Item>(); items.Add(tradeContents.Item1); items.Add(tradeContents.Item2); items.Add(tradeContents.Item3); for (int i = 0; i < items.Count; i++) { Item item = items.ElementAt(i); Vector2 location; switch (i) { //Default case or there will be warnings default: location = firstBoxLocation; break; case 1: location = secondBoxLocation; break; case 2: location = thirdBoxLocation; break; } //TODO: Fix this spaghetti //The constructor of ItemBox is misused, don't but actionBarBackground as the sprite. if (item is Weapon) { tradeItemBoxes.Add(new ItemBox("item", location, ((Weapon)item).Sprite, (Weapon)item)); } else if (item is Shield) { tradeItemBoxes.Add(new ItemBox("item", location, ((Shield)item).Sprite, (Shield)item)); } else if (item is Charm) { tradeItemBoxes.Add(new ItemBox("item", location, ((Charm)item).Sprite, (Charm)item)); } } //tradeItemBoxes.Add(new ItemBox("item1", firstBoxLocation, actionBarBackground, tradeContents.Item1)); //tradeItemBoxes.Add(new ItemBox("item2", secondBoxLocation, actionBarBackground, tradeContents.Item2)); //tradeItemBoxes.Add(new ItemBox("item3", thirdBoxLocation, actionBarBackground, tradeContents.Item3)); healingButton = new StaticEntity("Healing", fourthBoxLocation, uiLoader.Get("potions")); resetButton = new StaticEntity("Reset Button", fifthBoxLocation, uiLoader.Get("reset")); saveButton = new StaticEntity("Save Button", new Vector2(GameConstants.WINDOW_WIDTH - GameConstants.TILE_SIZE * 3, GameConstants.TILE_SIZE * 2), uiLoader.Get("saveGame")); tradeItemBoxBackgrounds.Add(new StaticEntity("item1Background", firstBoxLocation, actionBarBackground)); tradeItemBoxBackgrounds.Add(new StaticEntity("item2Background", secondBoxLocation, actionBarBackground)); tradeItemBoxBackgrounds.Add(new StaticEntity("item3Background", thirdBoxLocation, actionBarBackground)); tradeItemBoxBackgrounds.Add(new StaticEntity("item4Background", fourthBoxLocation, actionBarBackground)); playerIsHealing = false; }