Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- public class LogicScript : MonoBehaviour
- {
- public int playerScore;
- public Text scoreText;
- public GameObject gameOverScreen;
- [ContextMenu("Increase Score")]
- public void addScore(int scoreToAdd)
- {
- playerScore = playerScore + scoreToAdd;
- scoreText.text = playerScore.ToString();
- Debug.Log("Score increased by " + scoreToAdd + ". Current score: " + playerScore);
- }
- public void restartGame()
- {
- SceneManager.LoadScene(SceneManager.GetActiveScene().name);
- }
- public void gameOver()
- {
- gameOverScreen.SetActive(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement