public override void Unsubscribe() { GUIForm.Paint -= OnPaint; MoveTimer.Tick -= OnMoveTimerTick; MoveTimer.Stop(); Destroyed -= OnDestroyed; }
private void Gameover() { vreme.Stop(); SpawnTimer.Stop(); MoveTimer.Stop(); ReduceSpeed.Stop(); GameOver go = new GameOver(lbScore.Text); DialogResult res = go.ShowDialog(); if (res == System.Windows.Forms.DialogResult.Retry) { veg.Clear(); score = 0; lbTime.Text = "60"; lbScore.Text = "0"; vreme.Start(); SpawnTimer.Start(); MoveTimer.Start(); pb1.Visible = true; pb2.Visible = true; pb3.Visible = true; canvas.Invalidate(); SpawnTimer.Interval = 10; progress.Value = 60; isPressed = false; ReduceSpeed.Start(); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.Closed" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> that contains the event data.</param> protected override void OnClosed(EventArgs e) { base.OnClosed(e); CloseTimer.Stop(); MoveTimer.Stop(); }
private void 멈추기SToolStripMenuItem_Click(object sender, EventArgs e) { if (MoveTimer.Enabled) { toolStop.Text = "움직이기(&S)"; if (hling == null) { hling = new Thread(new ThreadStart(Howling)); hling.Start(); } else { hling.Abort(); hling = new Thread(new ThreadStart(Howling)); hling.Start(); } MoveTimer.Stop(); } else { toolStop.Text = "멈추기(&S)"; MoveTimer.Start(); } if (dir != 4) { dir = 4; } else { dir = 0; } }
public static void Pause() { MoveTimer.Stop(); GenCarTimer.Stop(); WorkTimer.Stop(); LightsTimer.Stop(); }
public override void SetNewStageParameters() { MoveToStartPosition(); Dx = 0; Dy = 0; Direction = Direction.Up; Immortal = false; MoveTimer.Stop(); RespawnTimer.Start(); }
private void timer1_Tick(object sender, EventArgs e) { if (MoveNo < Moves.Count) { var move = Moves[MoveNo]; if (FrameNo < FrameCount) { if (FrameNo == 0) { RubikCube.Select(move); RubikCube.Group(); } double angle = (move.Angle + 1) * 90; if (angle > 180) { angle -= 360; } var ratio = (double)FrameNo / (FrameCount - 1); angle *= ratio; RubikCube.Wall.LoadIdentity(); if (move.Axis == 0) { RubikCube.Wall.RotateX(angle); } else if (move.Axis == 1) { RubikCube.Wall.RotateY(angle); } else { RubikCube.Wall.RotateZ(angle); } FrameNo++; tglView1.Invalidate(); } else { FrameNo = 0; MoveNo++; RubikCube.Ungroup(); RubikCube.MakeMove(move); } } else { MoveTimer.Stop(); Moves.Clear(); MoveNo = 0; if (HighScore > 0) { Solve(); } } }
private void pauseToolStripMenuItem_Click(object sender, EventArgs e) { if (paused) { MoveTimer.Stop(); } else { MoveTimer.Start(); } paused = !paused; }
public override void SetNewStageParameters() { MoveToStartPosition(); Direction = Direction.Down; Lives = 0; Stars = GameRandom.RandNumber(0, 3); Immortal = false; Amphibian = false; Gun = false; MoveTimer.Stop(); RespawnTimer.Start(); }
} // Oyun sırasını hareketlendiren timer private void MoveA_Tick(object sender, EventArgs e) { if (turnMoveTEMP == turnMoveMAX) { playerTurn++; MoveTimer.Stop(); } else { moveTo(); turnMoveTEMP++; } } // Oyuncu hareketlerini sürdüren timer
/// <summary> /// Handles the Tick event of the MoveTimer control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void MoveTimer_Tick(object sender, EventArgs e) { OpacityValue += OpacityStep; if (Location.Y > Screen.PrimaryScreen.WorkingArea.Height - Height) { Location = new Point(Location.X, Location.Y - 2); } else { if (OpacityValue == 1.0) { MoveTimer.Stop(); CloseTimer.Start(); } } }
public static void Stop() { Car.Clear(); Deleter.Clear(); MoveTimer.Stop(); LightsTimer.Stop(); GenCarTimer.Stop(); WorkTimer.Stop(); CarCount.Text = "0"; CurrentlyCarCount.Text = "0"; WorkTime.Text = "0 c"; Cpm.Text = "0"; WorkTm = 0; UserPanel.ResetBackColor(); UserPanel.Invalidate(); }
public override void SetNewGameParameters() { MoveToStartPosition(); Dx = 0; Dy = 0; Direction = Direction.Up; HP = 1; Lives = 2; Stars = 0; Immortal = false; Amphibian = false; Gun = false; Ammo = 1; Points = 0; MoveTimer.Stop(); }
} // Static değişkenler bu fonksiyonda set ediliyor. private void CreateGame() { pnlBoard.Controls.Clear(); if (MoveTimer.Enabled == true) { MoveTimer.Stop(); } if (TurnTimer.Enabled == true) { TurnTimer.Stop(); } goldList.Clear(); playerList.Clear(); btnPlayStop.AccessibleName = "2"; btnPlayStop.Image = Properties.Resources.playButton; turnMoveTEMP = 1; playerTurn = 1; countLivePlayers = 4; logNum = 0; textPlayerACoin.Text = "200"; textPlayerBCoin.Text = "200"; textPlayerCCoin.Text = "200"; textPlayerDCoin.Text = "200"; int areaTotalSize = areaXSize * areaYSize; // Oyun alanında ki toplam kare sayısı int cellWidth = Convert.ToInt32(Math.Floor(Convert.ToDouble(pnlBoard.Width) / areaXSize)); // Alandaki Bir karenin genişliği int cellHeight = Convert.ToInt32(Math.Floor(Convert.ToDouble(pnlBoard.Height) / areaYSize)); // Alandaki Bir karenin uzunluğu int playerAFirstSpawn = 1; int playerBFirstSpawn = areaXSize; int playerCFirstSpawn = areaTotalSize; int playerDFirstSpawn = areaTotalSize - (areaXSize - 1); GenerateGolds(areaTotalSize, playerAFirstSpawn, playerBFirstSpawn, playerCFirstSpawn, playerDFirstSpawn); GenerateMap(areaTotalSize, cellWidth, cellHeight); GeneratePlayers(cellWidth, cellHeight, playerAFirstSpawn, playerBFirstSpawn, playerCFirstSpawn, playerDFirstSpawn); } // Oyunu oluşturan fonksiyon
private void OnDestroyed(object sender, EventArgs e) { MoveTimer.Stop(); ExplosionTimer.Start(); }
private void MoveTimer_Tick(object sender, EventArgs e) { MoveTimer.Stop(); graphic.Wait4Move(); }
} // Gelen stringleri log listesine ekleyen fonksiyon #endregion GlobalFunctions #region GameDynamics private void moveTo() { Player player = playerList.Where(p => p.playerdID == playerTurn).SingleOrDefault(); Cordinant startSpot = player.playerLocation, endSpot = FindCordinant(player.target); Button playerButton = (pnlBoard.Controls["player" + player.playerName] as Button); if (startSpot.row < endSpot.row) { startSpot.row++; playerButton.Location = (pnlBoard.Controls["btn" + (player.buttonNum + areaXSize)] as Button).Location; player.playerLocation = startSpot; player.buttonNum += areaXSize; player.playerButtonName = "btn" + player.buttonNum.ToString(); OpenSecret(player.buttonNum); player.StepCount++; addLog(player.playerName + " Oyuncusu " + player.StepCount + ". adımında " + player.buttonNum + ". kareye ilerledi"); } else if (startSpot.row > endSpot.row) { startSpot.row--; playerButton.Location = (pnlBoard.Controls["btn" + (player.buttonNum - areaXSize)] as Button).Location; player.playerLocation = startSpot; player.buttonNum -= areaXSize; player.playerButtonName = "btn" + player.buttonNum.ToString(); OpenSecret(player.buttonNum); player.StepCount++; addLog(player.playerName + " Oyuncusu " + player.StepCount + ". adımında " + player.buttonNum + ". kareye ilerledi"); } else if (startSpot.column < endSpot.column) { startSpot.column++; playerButton.Location = (pnlBoard.Controls["btn" + (player.buttonNum + 1)] as Button).Location; player.playerLocation = startSpot; player.buttonNum += 1; player.playerButtonName = "btn" + player.buttonNum.ToString(); OpenSecret(player.buttonNum); player.StepCount++; addLog(player.playerName + " Oyuncusu " + player.StepCount + ". adımında " + player.buttonNum + ". kareye ilerledi"); } else if (startSpot.column > endSpot.column) { startSpot.column--; playerButton.Location = (pnlBoard.Controls["btn" + (player.buttonNum - 1)] as Button).Location; player.playerLocation = startSpot; player.buttonNum -= 1; player.playerButtonName = "btn" + player.buttonNum.ToString(); OpenSecret(player.buttonNum); player.StepCount++; addLog(player.playerName + " Oyuncusu " + player.StepCount + ". adımında " + player.buttonNum + ". kareye ilerledi"); } if (player.buttonNum == player.target) { playerTurn++; MoveTimer.Stop(); Gold takenGold = goldList.Where(p => p.buttonNum == player.target).SingleOrDefault(); addLog(player.playerName + " Oyuncusu kare numarası " + player.target + " olan hedefine ulaştı ve " + takenGold.value + " altın kazanadı "); takenGold.isTaken = true; (pnlBoard.Controls[takenGold.button] as Button).BackgroundImage = Properties.Resources.Dirt; List <Player> playerLoseTargetList = playerList.Where(p => p.target == player.target).ToList(); foreach (var item in playerLoseTargetList) { item.target = 0; if (item.playerdID != player.playerdID) { addLog(player.playerName + " Oyuncusu " + item.playerName + " oyuncusunun hedefini çaldı"); } } player.playerGold += takenGold.value; player.collectedGold += takenGold.value; (pictureBox2.Controls["textPlayer" + player.playerName + "Coin"] as Label).Text = player.playerGold.ToString(); } } // Sonraki hamleyi gerçekleştiren fonksiyon