Esempio n. 1
0
 /// <summary>
 /// atspausdina pateikta tanku HeroContainer
 /// </summary>
 /// <param name="prints"> spausdinimui skirtas masyvas</param>
 /// <param name="fileName">Spausdinimo failas</param>
 public void PrintTanks(HeroContainer prints, string fileName)
 {
     using (StreamWriter writer = new StreamWriter(fileName,
                                                   false, Encoding.UTF8))
     {
         writer.WriteLine("Veikejai turintys tanko savybes :");
         writer.WriteLine();
         writer.WriteLine("Rasė,Vardas,Klasė,Galia");
         writer.WriteLine();
         for (int i = 0; i < prints.Count; i++)
         {
             writer.WriteLine(prints.GetHero(i).TankToString());
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// suranda herojus kurie atitinka tanko parametrus
        /// </summary>
        /// <param name="branches">masyvas su visu rasiu duomenis</param>
        /// <returns></returns>
        public HeroContainer FindTanks(Branch[] branches)
        {
            var temp = new HeroContainer(Branch.MaxNumberOfHeroes);

            for (int i = 0; i < branches.Length; i++)
            {
                for (int j = 0; j < branches[i].Heroes.Count; j++)
                {
                    if (branches[i].Heroes.GetHero(j).IsTank(TankHealth,
                                                             TankDefence))
                    {
                        temp.AddHero(branches[i].Heroes.GetHero(j));
                    }
                }
            }
            return(temp);
        }