Beispiel #1
0
        public void Tick()
        {
            CurrentCycle++;
            //no magical constznts
            int _cyclesInYear = 6;

            if (CurrentCycle % _cyclesInYear == 0)
            {
                mainQueen.SetSeason(Seasons.Winter);
            }
            else if (CurrentCycle % _cyclesInYear == 3)
            {
                mainQueen.SetSeason(Seasons.Summer);
            }

            Console.WriteLine("\n\nOne more cycle has started");
            Console.WriteLine("Honey at start = {0}", StoredHoney);

            WorkEventArgs e = new WorkEventArgs(dangerFunc());

            OnWorkStart(e);
            //WorkStart(dangerFunc());

            Console.WriteLine("Honey at end = {0}", StoredHoney);
            Console.WriteLine("One more cycle has ended\n\n");
        }
Beispiel #2
0
        protected virtual void OnWorkStart(WorkEventArgs e)
        {
            EventHandler <WorkEventArgs> handler = WorkStart;

            if (handler != null)
            {
                handler(this, e);
            }
        }