40 lines
890 B
C#
40 lines
890 B
C#
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;
|
|
public AudioSource BG_Music;
|
|
public BackgroundScroller bgscript;
|
|
|
|
|
|
void Start()
|
|
{
|
|
bgscript = GameObject.FindGameObjectWithTag("Background").GetComponent<BackgroundScroller>();
|
|
}
|
|
|
|
public void addScore(int scoreToAdd){
|
|
playerScore += scoreToAdd;
|
|
scoreText.text = playerScore.ToString();
|
|
}
|
|
|
|
public void restartGame() {
|
|
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
|
}
|
|
|
|
public void gameOver() {
|
|
gameOverScreen.SetActive(true);
|
|
BG_Music.Stop();
|
|
bgscript.ScrollSpeed = 0f;
|
|
}
|
|
|
|
void Update() {
|
|
|
|
}
|
|
}
|