SquareDash/Assets/LogicScript.cs
kingjuulian06 0efb85038a Arbeit 2
2023-11-21 22:03:49 +01:00

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() {
}
}