added sound script and menu
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
using System;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using VContainer;
|
||||
|
||||
public class ScoreService
|
||||
{
|
||||
public Action<int> onScoreUpdate;
|
||||
|
||||
public int score { get; private set; }
|
||||
public int HighScore = PlayerPrefs.GetInt("HighScore", 0);
|
||||
[Inject] GameScreenController gameScreenController;
|
||||
[Inject] StartScreenController startScreenController;
|
||||
|
||||
public void AddScore()
|
||||
{
|
||||
if (!startScreenController.hasGameStarted) return;
|
||||
score += 5;
|
||||
onScoreUpdate?.Invoke(score);
|
||||
gameScreenController.UpdateScore(score);
|
||||
if(score>HighScore)
|
||||
{
|
||||
SetHighScore();
|
||||
|
||||
Reference in New Issue
Block a user