Ejemplo n.º 1
0
        private void BattleStartButton_Click(object sender, EventArgs e)
        {
            if (timeLabel.Text != "Off")
            {
                BattleTimer.Stop();
                timeLabel.Text = "Off";
                return;
            }

            if (timeLeft == 0)
            {
                timeLeft       = randomizer.Next(min, max);
                timeLabel.Text = timeLeft.ToString();
            }
            BattleTimer.Interval = 1000;
            BattleTimer.Start();
        }
Ejemplo n.º 2
0
        private async void BattleTimer_Tick(object sender, EventArgs e)
        {
            if (timeLeft > 0)
            {
                timeLeft       = timeLeft - 1;
                timeLabel.Text = timeLeft.ToString();
                return;
            }

            BattleTimer.Stop();
            int random = randomizer.Next(10);

            switch (random)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                timeLabel.Text = "zombie";
                await ZombieRun();

                break;

            case 6:
            case 7:
            case 8:
                timeLabel.Text = "rat";
                await RatRun();

                break;

            case 9:
            default:
                timeLabel.Text = "skeleton";
                await SkeletonRun();

                break;
            }

            timeLeft = randomizer.Next(min, max);
            BattleTimer.Start();
        }
Ejemplo n.º 3
0
 public void Stop()
 {
     BattleTimer.Stop();
     Resources.Sessions.Remove(Session.Id);
 }