i3e-asg2/Assets/Scripts/GameManager.cs
2024-07-02 10:42:09 +08:00

27 lines
543 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
public static GameManager instance;
void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else if (instance != null && instance != this)
{
Destroy(gameObject);
}
}
public int playerHealth = 100;
public void damagePlayer(int damage)
{
playerHealth-=damage;
}
}