コード例 #1
0
        /// <summary>
        /// Vyrobenie - teda vznikn� cestuj�ci a po�ta
        /// </summary>
        public void Vyrob() 
        {
            if(Zoskupenie != null)
            {
                int temp = Populacia / cIntervalDni;

                int pocetCestujucich = temp/5;

                if (pocetCestujucich > 0)
                {
                    pocetCestujucich = Nahoda.TriaInt(pocetCestujucich - 1, pocetCestujucich, pocetCestujucich + 2);
                }
                else 
                {
                    pocetCestujucich = 1;
                }

                int pocetPosty = temp / 10;

                if (pocetPosty > 0)
                {
                    pocetPosty = Nahoda.TriaInt(pocetPosty - 1, pocetPosty, pocetPosty + 2);
                }
                else
                {
                    pocetPosty = 1;
                }

                for (int i = 0; i < pocetCestujucich; i++)
                {
                    Zoskupenie.NechajCakat(new PrepravJednotka(TypPrepravJednotky.cestujuci));
                }

                for (int i = 0; i < pocetPosty; i++)
                {
                    Zoskupenie.NechajCakat(new PrepravJednotka(TypPrepravJednotky.posta));
                }
                Console.WriteLine("Mesto, cest: " + pocetCestujucich + ", post: " + pocetPosty);
            }
        }
コード例 #2
0
 /// <summary>
 /// Odstranenie odkazu na objekt
 /// </summary>
 public void Zburaj()
 {
     Zoskupenie.ZmazPripojenuStanicu(this);
 }