private void timer1_Tick(object sender, EventArgs e) { if (currentGame.ProcessWeaponEffects() == false) { currentGame.GravityStep(); DrawBackground(); DrawGameplay(); displayPanel.Invalidate(); if (currentGame.GravityStep() == true) { return; } else { timer1.Enabled = false; if (currentGame.FinishTurn() == true) { NewTurn(); } else { Dispose(); currentGame.NextRound(); return; } } } else { DrawGameplay(); displayPanel.Invalidate(); return; } }
/// <summary> /// Tick event for the timer. Handles much of the animation and physics. This also handles the forms, /// whether to close the current form or create a new gameplay form. /// /// Author John Santias and Hoang Nguyen October 2017 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void formTimer_Tick(object sender, EventArgs e) { currentGame.ProcessEffects(); if (!currentGame.ProcessEffects()) { currentGame.Gravity(); DrawBackground(); DrawGameplay(); displayPanel.Invalidate(); if (currentGame.Gravity()) { return; } else { formTimer.Enabled = false; bool turnOver = currentGame.TurnOver(); NewTurn(); spacePressed = false; //prevents the player from pressing the space bar multiple times if (!turnOver) { if (currentGame.GetRound() >= currentGame.GetTotalRounds()) { currentGame.NextRound(); Dispose(); } else { Dispose(); currentGame.NextRound(); return; } } } } else { DrawGameplay(); displayPanel.Invalidate(); return; } }
private void timer1_Tick(object sender, EventArgs e) { Debug.WriteLine("TimerEventProcessor start"); if (!currentGame.ProcessWeaponEffects()) { Debug.WriteLine("if (!currentGame.ProcessWeaponEffects())"); currentGame.CalculateGravity(); DrawBackground(); DrawGameplay(); displayPanel.Invalidate(); if (currentGame.CalculateGravity()) { Debug.WriteLine("return calculated gravity"); return; } else { Debug.WriteLine("disable timer"); timer1.Enabled = false; if (currentGame.TurnOver()) { NewTurn(); Debug.WriteLine("Newturn done"); } else { Debug.WriteLine("turn over not done"); Dispose(); currentGame.NextRound(); return; } } } else { Debug.WriteLine("else processing"); DrawGameplay(); displayPanel.Invalidate(); return; } }
/// <summary> /// Tick event for the timer. Handles much of the animation and physics. This also handles the forms, /// whether to close the current form or create a new gameplay form. /// /// Author John Santias and Hoang Nguyen October 2017 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void formTimer_Tick(object sender, EventArgs e) { currentGame.ProcessEffects(); if (currentGame.ProcessEffects() == false) { currentGame.Gravity(); DrawBackground(); DrawGameplay(); displayPanel.Invalidate(); if (currentGame.Gravity()) { return; } else { formTimer.Enabled = false; bool turnOver = currentGame.TurnOver(); NewTurn(); if (!turnOver) { Dispose(); currentGame.NextRound(); if (currentGame.GetRound() > currentGame.GetTotalRounds()) { Dispose(); } return; } } } else { DrawGameplay(); displayPanel.Invalidate(); return; } }