Esempio n. 1
0
 public Resource(string nameText, VColor nameForeground, int size = 1)
 {
     NameText       = nameText;
     NameForeground = nameForeground;
     Size           = size;
     AllResources.Add(this);
 }
Esempio n. 2
0
 private static void AddLanguage(PropertyInfo[] keys, ResourceManager resourceManager, string languageName, string cultureName)
 {
     if (!AllResources.ContainsKey(languageName) && !string.IsNullOrWhiteSpace(languageName))
     {
         AllResources.Add(languageName, keys.ToDictionary(
                              key => key.Name,
                              key => resourceManager.GetString(
                                  key.Name,
                                  new CultureInfo(cultureName))));
     }
 }
Esempio n. 3
0
 public void OnFinish(AllResources allResources)
 {
     try
     {
         ResourceListStore.Instance.Save(Paths.Getter().ResourceList(), allResources);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     _outerInstance._isScanning = false;
 }
Esempio n. 4
0
        /// <summary>
        /// It takes 3 WOOD, 5 IRON, 2 STONE to upgrade defense
        /// </summary>
        public void AddDefenseToHome()
        {
            Resource wood  = AllResources.Find(x => x.Name.Contains("Wood"));
            Resource iron  = AllResources.Find(x => x.Name.Contains("Iron"));
            Resource stone = AllResources.Find(x => x.Name.Contains("Stone"));

            if (Player.Resources[wood] >= 3 &&
                Player.Resources[iron] >= 5 &&
                Player.Resources[stone] >= 2)
            {
                Home.AddDefense((Home.Defence + 2));
            }
        }
Esempio n. 5
0
 /// <summary>
 /// It takes 5 GRAINS to add new citizens.
 /// </summary>
 public void AddCitizenToHome()
 {
     foreach (Resource r in AllResources)
     {
         if (r == AllResources.Find(x => x.Name.Contains("Grain")))
         {
             if (Player.Resources.ContainsKey(r))
             {
                 if (Player.Resources[r] - 5 >= 0)
                 {
                     int i = Player.Resources[r] / 5;
                     Player.Resources[r] = Player.Resources[r] - (5 * i);
                     Home.AddCitizens(Home.Citizens + i);
                 }
             }
         }
     }
 }
Esempio n. 6
0
        public void Setup()
        {
            string[] gunnames = new string[] { "Excalibur", "Glock", "Assualt Rifle"
                                               , "Red John", "Heaven Bringer", "Glory", "Lucy" };
            string[] swordnames = new string[] { "Champion", "Wooden sword", "Stormbringer"
                                                 , "Mournblade", "Sword of Dawn", "RavenBrand", "Harry" };
            string[] armournames = new string[] { "Hide Armour", "Iron Armour", "Elestial Armour"
                                                  , "Windbreaker", "A Sheet", "A leaf", "Diamond Glades" };

            // be mindfull of the size of the arrays, as they need to be equal length
            if (gunnames.Length - swordnames.Length != 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (gunnames.Length - armournames.Length != 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            ItemFactory fact = new ItemFactory();

            for (int i = 0; i < gunnames.Length; i++)
            {
                //var gun = fact.CreateItem<Gun>();
                //allItems.Add(gunnames[i], gun);
                //allItems[gunnames[i]].Name = gunnames[i];
                ////AllItems.Add(gun);
                //var sword = fact.CreateItem<Sword>();
                //allItems.Add(swordnames[i], sword);
                //allItems[swordnames[i]].Name = swordnames[i];
                ////AllItems.Add(sword);
                //var armour = fact.CreateItem<Clothing>();
                //allItems.Add(armournames[i], armour);
                //allItems[armournames[i]].Name = armournames[i];
                ////AllItems.Add(armour);

                Item gun = new Gun(gunnames[i]);
                AllItems.Add(gun.Name, gun);
                Item sword = new Sword(swordnames[i]);
                AllItems.Add(sword.Name, sword);
                Item armour = new Clothing(armournames[i]);
                AllItems.Add(armour.Name, armour);
            }

            //var fist = fact.CreateItem<Sword>();
            Item fist = new Weapon("Fist");

            AllItems.Add("Fist", fist);

            Player.MakeItem(AllItems["Fist"]);
            Player.EquipItem(AllItems["Fist"]);

            Player.EquipItem(AllItems["Hide Armour"]);

            Console.WriteLine(Player.EquipedWeapon.ToString());

            AllResources.Add(new Resource("Wood"));  // for home / defence
            AllResources.Add(new Resource("Iron"));  // make weapons / clothes
            AllResources.Add(new Resource("Grain")); // for the citizens
            AllResources.Add(new Resource("Wool"));  // for clothes
            AllResources.Add(new Resource("Stone")); // for home / defence

            string[] enemyList = { "Rebelious Farmer", "Giant Wolf", "Lost Knight", "Sneaky Ninja", "Slow Oger", "Swift Reeves", "Mad Scientist" };

            for (int i = 0; i < enemyList.Length; i++)
            {
                int damageRandom = rand.Next(1, 51);
                Enemys.Add(new Enemy(enemyList[i], damageRandom));
            }

            GenerateMap();
        }
Esempio n. 7
0
 public void CopyTo(IResource[] array, int arrayIndex) => AllResources.CopyTo(array, arrayIndex);
Esempio n. 8
0
 public bool Contains(IResource item) => AllResources.Contains(item);
Esempio n. 9
0
 public IEnumerator <IResource> GetEnumerator() => AllResources.GetEnumerator();