Example #1
0
        public void InitEggs(object sender, EventArgs e)
        {
            Egg eg = new Egg(_r.Next(1, MaxSpawnIndex + 1));

            _countOfEggs.Add(eg);
            eg.TimerStop    += EggRemove;
            eg.ReadyToCatch += ReadyToCatch;
            eg.AnimationEnd += AnimationEnd;
            InitEgg?.Invoke(eg, new EventArgs());

            eg.timer.Interval = TimeSpan.FromSeconds(FrameChangeInterval);
            eg.timer.Start();
        }
Example #2
0
        public void EggBroken(Egg brokenEgg)
        {
            TimerStop?.Invoke(this, new EventArgs());
            BrokenEggs++;

            foreach (Egg eg in _countOfEggs)
            {
                if (eg != brokenEgg)
                {
                    eg.timer.Stop();
                    DeleteEgg?.Invoke(eg, new EventArgs());
                }
            }

            LifeActivate?.Invoke(this, new EventArgs());
        }