Esempio n. 1
0
 public city(string name, string owner, tileLib tileLibrary, int cityID)
 {
     this.name = name;
     this.owner = owner;
     this.peopleCap = 5;
     this.foodStash = 0;
     this.tileLibrary = tileLibrary;
     this.cityID = cityID;
 }
Esempio n. 2
0
        public unitLib(tileLib tileLibrary)
        {
            CreateNewUnit(infoLibrary.Scout("max", 0), 104, tileLibrary);
            CreateNewUnit(infoLibrary.Warrior("max", 0), 87, tileLibrary);
            CreateNewUnit(infoLibrary.Warrior("barb", 0), 125, tileLibrary);

            CreateNewUnit(infoLibrary.Hero("max", 0), 53, tileLibrary);
            CreateNewUnit(infoLibrary.Hero("barb", 0), 126, tileLibrary);

            //unitList.Add(infoLibrary.Scout("max", 0));
            //unitList.Add(infoLibrary.Warrior("max", 0));
            //unitList.Add(infoLibrary.Warrior("max", 0));

            // tempTileList[104].addUnit(0);
            // tempTileList[87].addUnit(1);
            // tempTileList[125].addUnit(2);
        }
Esempio n. 3
0
 public void checkForFinishedBuilding(unitLib uLib, tileLib tLib)
 {
     if (productionProgress >= buildingInProgress.prodCost)
     {
         if (buildingInProgress.name == "Scout")
         {
             uLib.CreateNewUnit(infoLibrary.Scout("max", 0), tLib.FindIndex_AtTile(tLib.FindTile_AtCityID(cityID)), tLib);
             buildingInProgress = null;
         }
         else if (buildingInProgress.name == "Warrior")
         {
             uLib.CreateNewUnit(infoLibrary.Warrior("max", 0), tLib.FindIndex_AtTile(tLib.FindTile_AtCityID(cityID)), tLib);
             buildingInProgress = null;
         }
         else
         {
             buildingList.Add(buildingInProgress);
             buildingInProgress = null;
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Låter två enheter slåss och om de dör så försvinner de som dog
        /// </summary>
        /// <param name="Attacker"></param>
        /// <param name="Defender"></param>
        public void FIGHT(unit Attacker, unit Defender, tileLib tileLibrary)
        {
            if (Attacker.CurrentCanAtk > 0)
            {

            Attacker.BattleAnotherUnit(Defender);
            }
            if (Attacker.CurrentHp <= 0)
            {
                unitList.RemoveAt(FindIndexOfUnit_AtUnitID(Attacker.unitID));
                tileLibrary.FindTile_AtUnitID(Attacker.unitID).removeUnit(Attacker.unitID);
            }
            if (Defender.CurrentHp <= 0)
            {
                tileLibrary.FindTile_AtUnitID(Attacker.unitID).removeUnit(Attacker.unitID);

                tileLibrary.FindTile_AtUnitID(Defender.unitID).addUnit(Attacker.unitID);
                unitList.RemoveAt(FindIndexOfUnit_AtUnitID(Defender.unitID));
                tileLibrary.FindTile_AtUnitID(Defender.unitID).removeUnit(Defender.unitID);

            }
        }
Esempio n. 5
0
 /// <summary>
 /// Skapar en ny enhet på  givet index i världen, kräver inte att du ger en annan unitID än 0
 /// ge den dessutom en index i världen att vara
 /// </summary>
 /// <param name="UnitType"></param>
 public void CreateNewUnit(unit UnitType, int index, tileLib tileLibray)
 {
     UnitType.unitID = unitList.Count;
     unitList.Add(UnitType);
     tileLibray.TileList[index].addUnit(UnitType.unitID);
 }