using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { public static GameManager _instance; public int score = 0; void Awake() { _instance = this; } // Update is called once per frame void Update () { } }
在enemy脚本设置方法如下
public int score=100; public bool isExplosion = false; //死亡并得分 public void ToDeadGetScore() { isExplosion = true; GameManager._instance.score += score; }
时间: 2024-10-17 21:04:00