public void GetScore(Pipe pipe, HighScoreInfo highScore) { string FilePath = Environment.CurrentDirectory + "/" + "temp.txt"; if ((X_Bird >= pipe.X_pipePairs1 + pipe.recPipe.Width && X_Bird - 3 <= pipe.X_pipePairs1 + pipe.recPipe.Width) || (X_Bird >= pipe.X_pipePairs2 + pipe.recPipe.Width && X_Bird - 3 <= pipe.X_pipePairs2 + pipe.recPipe.Width)) { highScore.scoreOfGame++; StreamWriter sw = new StreamWriter(FilePath); sw.Write(highScore.scoreOfGame.ToString()); sw.Close(); //c1.Text = highScore.scoreOfGame.ToString(); SoundPoint(); } if (isGetGift) { if ((X_Bird >= pipe.X_pipePairs1 + pipe.recPipe.Width && X_Bird - 20 <= pipe.X_pipePairs1 + pipe.recPipe.Width) || (X_Bird >= pipe.X_pipePairs2 + pipe.recPipe.Width && X_Bird - 20 <= pipe.X_pipePairs2 + pipe.recPipe.Width)) { highScore.scoreOfGame++; StreamWriter sw = new StreamWriter(FilePath); sw.Write(highScore.scoreOfGame.ToString()); sw.Close(); //c1.Text = highScore.scoreOfGame.ToString(); SoundPoint(); } } }
public void Impact_Coins_Bird(Bird bird, HighScoreInfo highScore) { if (bird.X_Bird + bird.recBird.Width >= X_Coins && bird.X_Bird <= X_Coins + picBoxCoins.Width) { // increase score if (bird.Y_Bird + bird.recBird.Height >= Y_Coins && bird.Y_Bird <= Y_Coins + picBoxCoins.Height) { SoundCash(); if (picBoxCoins.Visible) { highScore.scoreOfGame += 3; } picBoxCoins.Visible = false; } } }