Example #1
0
        private void Tm_Tick(object sender, EventArgs e)
        {
            switch (map.GetGameOrder())
            {
            case 1:
                if (aPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(aPlayer);
                    aPlayer.SetPlayerMapValue(aPlayer.GetLastCord()[0], aPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    ALog.Items.Clear();
                    for (int i = aPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        ALog.Items.Add(aPlayer.GetLog()[i]);
                    }
                    break;
                }
                aPlayer.Move(map);
                aPlayerKasa.Text = aPlayer.GetPlayerGold().ToString();
                if (aPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(aPlayer);
                    aPlayer.SetPlayerMapValue(aPlayer.GetLastCord()[0], aPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    ALog.Items.Clear();
                    for (int i = aPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        ALog.Items.Add(aPlayer.GetLog()[i]);
                    }
                    break;
                }
                GraphicDraw();
                ALog.Items.Clear();
                for (int i = aPlayer.GetLog().Count - 1; i >= 0; i--)
                {
                    ALog.Items.Add(aPlayer.GetLog()[i]);
                }
                map.SetGameOrder();
                siradaki.Text = GameOrderString(map.GetGameOrder());
                break;

            case 2:
                if (bPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(bPlayer);
                    bPlayer.SetPlayerMapValue(bPlayer.GetLastCord()[0], bPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    BLog.Items.Clear();
                    for (int i = bPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        BLog.Items.Add(bPlayer.GetLog()[i]);
                    }
                    break;
                }
                bPlayer.Move(map);
                bPlayerKasa.Text = bPlayer.GetPlayerGold().ToString();
                if (bPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(bPlayer);
                    bPlayer.SetPlayerMapValue(bPlayer.GetLastCord()[0], bPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    BLog.Items.Clear();
                    for (int i = bPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        BLog.Items.Add(bPlayer.GetLog()[i]);
                    }
                    break;
                }
                GraphicDraw();
                BLog.Items.Clear();
                for (int i = bPlayer.GetLog().Count - 1; i >= 0; i--)
                {
                    BLog.Items.Add(bPlayer.GetLog()[i]);
                }
                map.SetGameOrder();
                siradaki.Text = GameOrderString(map.GetGameOrder());
                break;

            case 3:
                if (cPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(cPlayer);
                    cPlayer.SetPlayerMapValue(cPlayer.GetLastCord()[0], cPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    CLog.Items.Clear();
                    for (int i = cPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        CLog.Items.Add(cPlayer.GetLog()[i]);
                    }
                    break;
                }
                cPlayer.Move(map);
                cPlayerKasa.Text = cPlayer.GetPlayerGold().ToString();
                if (cPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(cPlayer);
                    cPlayer.SetPlayerMapValue(cPlayer.GetLastCord()[0], cPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    CLog.Items.Clear();
                    for (int i = cPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        CLog.Items.Add(cPlayer.GetLog()[i]);
                    }
                    break;
                }
                GraphicDraw();
                CLog.Items.Clear();
                for (int i = cPlayer.GetLog().Count - 1; i >= 0; i--)
                {
                    CLog.Items.Add(cPlayer.GetLog()[i]);
                }
                map.SetGameOrder();
                siradaki.Text = GameOrderString(map.GetGameOrder());
                break;

            case 4:
                if (dPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(dPlayer);
                    dPlayer.SetPlayerMapValue(dPlayer.GetLastCord()[0], dPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    DLog.Items.Clear();
                    for (int i = dPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        DLog.Items.Add(dPlayer.GetLog()[i]);
                    }
                    break;
                }
                dPlayer.Move(map);
                dPlayerKasa.Text = dPlayer.GetPlayerGold().ToString();
                if (dPlayer.IsDeath() == true)
                {
                    map.RemovePlayersIsDeath(map.GetGameOrder());
                    map.SetGameOrder();
                    siradaki.Text = GameOrderString(map.GetGameOrder());
                    PlayerDeathPictureDraw(dPlayer);
                    dPlayer.SetPlayerMapValue(dPlayer.GetLastCord()[0], dPlayer.GetLastCord()[1], 0);
                    GraphicDraw();
                    DLog.Items.Clear();
                    for (int i = dPlayer.GetLog().Count - 1; i >= 0; i--)
                    {
                        DLog.Items.Add(dPlayer.GetLog()[i]);
                    }
                    break;
                }
                GraphicDraw();
                DLog.Items.Clear();
                for (int i = dPlayer.GetLog().Count - 1; i >= 0; i--)
                {
                    DLog.Items.Add(dPlayer.GetLog()[i]);
                }
                map.SetGameOrder();
                siradaki.Text = GameOrderString(map.GetGameOrder());
                break;

            default:
                break;
            }

            if (map.GetgameOver() == true)
            {
                tm.Stop();
                MessageBox.Show(map.GetgameOverReason() + " Oyun bitti.");
                aPlayer.SetLog(map.GetgameOverReason());
                bPlayer.SetLog(map.GetgameOverReason());
                cPlayer.SetLog(map.GetgameOverReason());
                dPlayer.SetLog(map.GetgameOverReason());
                aPlayer.SetLog("Oyun Bitti");
                bPlayer.SetLog("Oyun Bitti");
                cPlayer.SetLog("Oyun Bitti");
                dPlayer.SetLog("Oyun Bitti");
                ScoreBoard scoreBoard = new ScoreBoard(aPlayer, bPlayer, cPlayer, dPlayer, map, this);
                scoreBoard.Show();
            }
        }