Пример #1
0
        public virtual void HolderDied()
        {
            if (Holder == null)
            {
                return;
            }

            WorldPosition.X = Holder.WorldPosition.X + 32;
            WorldPosition.Y = Holder.WorldPosition.Y;
            WorldPosition.Z = Holder.WorldPosition.Z;

            X = Holder.X + 32;
            Y = Holder.Y;
            Z = Holder.Z;

            SetOffset((ushort)(WorldPosition.X >> 12), (ushort)(WorldPosition.Y >> 12));

            // Automatically sets object visible
            SetHeldState(EHeldState.Ground);

            _evtInterface.AddEvent(ResetFromGround, GroundResetTime, 1);

            OnDropAction?.Invoke(this);

            Holder = null;
        }
Пример #2
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            if (!DataGame.StartGame)
            {
                return;
            }
            DataGame.MadeTicks += 0.01;

            try
            {
                BallMovement?.Invoke();
            }
            catch (OutOfBoundsException ex)
            {
                try
                {
                    DataGame.lifes--;
                    DataGame.StartGame = false;
                    timer1.Stop();

                    RepositionElements();
                    UpdateItems();

                    if (DataGame.lifes == 0)
                    {
                        throw new NoRemainingLifesException("");
                    }
                }
                catch (NoRemainingLifesException ex2)
                {
                    timer1.Stop();
                    FinishedGame?.Invoke();
                }
            }
        }
 private void Timer1_Tick(object sender, EventArgs e)
 {
     if (!DataGame.StartGame)
     {
         return;
     }
     DataGame.MadeTicks += 0.01;
     BallMovement?.Invoke();
 }