给游戏添加胜利UI,控制星星的显示、得金币数、杀敌数,并在商店页面关联金钱数量
在《EASY Manoeuvre FPS使用 (三) 修改ShopMenu》里已经设定好初始金额,那我们游戏结束后就要统计金币,所以要在游戏GameManager里做储存行为了。
在MainMenuShopController脚本里找到更新金币数量的储存字符
InGameCurrency = PlayerPrefs.GetInt("InGameCurrency", 1000);
在GameManager加入方法
//增加整体金钱
public void AddGold()
{
if (!GameOver)
{
PlayerPrefs.SetInt("InGameCurrency", PlayerPrefs.GetInt("InGameCurrency") + gold);
}
}