I have recently finished the unity official youtube flappy bird tutorial.
I want to give user the option that, after striking one of the columns he can watch a reward video and continue with his score. If he strikes a column again then again this screen will pop up.
This screen will have two buttons - watch video or let it be game over.
I dont know how to do this.
Following is my class:
public class GameControl : MonoBehaviour
{
public float scrollspeed = -1.5f;
public static GameControl instance;
public GameObject gameOverText;
public bool gameover = false;
public Text scoretext;
private int score = 0;
void Awake()
{
if(instance == null)
{
instance = this;
}
else if (instance!=null)
{
Destroy(gameObject);
}
}
void Update()
{
if (gameover == true && Input.GetMouseButtonDown (0))
{
SceneManager.LoadScene(SceneManager.GetActiveScene ().buildIndex);
}
}
public void BirdScored()
{
if(gameover)
{
return;
}
score++;
scoretext.text = "Score: " + score.ToString();
}
public void BirdDied()
{
gameOverText.SetActive(true);
gameover = true;
}
}
This class takes care of the bird dying process. how can i add the option to watch add and continue the game here?
Unity newbie here....
↧