58 lines
1000 B
C#
58 lines
1000 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Unity.VisualScripting;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class GameManager : MonoBehaviour
|
|||
|
{
|
|||
|
public static GameManager instance;
|
|||
|
|
|||
|
public float Score;
|
|||
|
public int DotNum;
|
|||
|
|
|||
|
public TMPro.TextMeshProUGUI scoreText;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
if (instance == null)
|
|||
|
{
|
|||
|
instance = this;
|
|||
|
DontDestroyOnLoad(gameObject);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Destroy(gameObject);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// <20>Զ<EFBFBD><D4B6>ӷּ<D3B7><D6BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public void AddScore(float amount)
|
|||
|
{
|
|||
|
Score += amount;
|
|||
|
DotNum--;
|
|||
|
UpdateScoreDisplay();
|
|||
|
if(DotNum<=0)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void AddDotNum(int addNotNum)
|
|||
|
{
|
|||
|
DotNum += addNotNum;
|
|||
|
// UpdateScoreDisplay();
|
|||
|
}
|
|||
|
|
|||
|
private void UpdateScoreDisplay()
|
|||
|
{
|
|||
|
if (scoreText != null)
|
|||
|
{
|
|||
|
scoreText.text = Score.ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|