public GameInitializer() { InitializeComponent(); Game pokemon = Game.Instance; pokemon.Title = "Pokémon"; pokemon.GameWidth = 800; pokemon.GamePathName = "Pokemon"; Area newBarkTown = NewBarkTown.Instance.Area; pokemon.Areas.Add(newBarkTown); pokemon.Areas.Add(RouteOne.Instance.Area); pokemon.CurrentArea = newBarkTown; pokemon.NextArea = newBarkTown; IPlayableCharacter red = ((IPlayableCharacter)CellObjectFactory.Build(CellObjectType.Hero)); red.BattleAttacks.Add(BattleAttackFactory.Build(AttackName.Stab)); red.ItemInventory.Add(InventoryItemFactory.Build(ItemName.SmallHealthPotion)); pokemon.PlayableCharacter = red; red.Position = (10, 8); InitializeGame(); }
public static void EatTrollsEar(this IPlayableCharacter player, IDice dice, Action <string> log) { var newHp = dice.Roll(20); log("Player eats the trolls ear."); player.IncreaseHealth(newHp); }
private void PlayerWakesUp(IPlayableCharacter player) { _log("Player wakes up..."); player.Walk(_dice.Roll(50)); _log("Player found some weapons and clothes."); _player.IncreaseHealth(_playerEquipmentRule.StartHealth); _player.IncreaseStrength(_playerEquipmentRule.StartStrength); player.WalkWithChanceOfStrengthIncrease(_dice, 50); }
public static void WalkWithChanceOfStrengthIncrease(this IPlayableCharacter player, IDice dice, int sides) { var meters = dice.Roll(sides); player.Walk(meters); if (meters % 3 == 0) { player.IncreaseStrength(dice.Roll(5)); } }
public GameInitializer() { InitializeComponent(); Game newGame = Game.Instance; newGame.Title = "Name your game here"; //Set total width of the game window in pixels newGame.GameWidth = 800; //Set this property to be the name of the game in your file structure. Used for finding the path // for the asset files newGame.GamePathName = "EmptyProject"; // Create a singleton object in the areas folder and instanciate it here Area firstArea = FirstArea.Instance.Area; // Add the area to the game newGame.Areas.Add(firstArea); //Set firstArea to be the starting area when you run the game newGame.CurrentArea = firstArea; //Change this to travel to a new area newGame.NextArea = firstArea; //Use a cell object factory to create a playable character to be used in the game IPlayableCharacter hero = (IPlayableCharacter)CellObjectFactory.Build(CellObjectFactory.CellObjectType.Hero); //From the battle attack factory, give your hero an attack to be used in battle hero.BattleAttacks.Add(BattleAttackFactory.Build(BattleAttackFactory.AttackName.Stab)); //From the inventory item factory, give your hero an item to keep in their inventory hero.ItemInventory.Add(InventoryItemFactory.Build(InventoryItemFactory.ItemName.SmallHealthPotion)); //Set your hero to be the playable character of the game newGame.PlayableCharacter = hero; //Set the start position of the character in the game hero.Position = (6, 6); //Start game InitializeGame(); }
public void Select() { playableCharacter = player.GetComponent <IPlayableCharacter>(); isSelected = true; }