GameManager.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using UnityEngine.EventSystems;
  4. namespace DuckHunter
  5. {
  6. public class GameManager : MonoBehaviour
  7. {
  8. public static GameManager Instance;
  9. [SerializeField] GameObject dogObject;
  10. [SerializeField] GameObject dogSideObject;
  11. [SerializeField] GameObject duckPrefab;
  12. [SerializeField] RectTransform duckBox;
  13. [System.NonSerialized] public bool isGameStarted;
  14. [System.NonSerialized] public bool isGameOver;
  15. public bool isGamePlaying { get => isGameStarted && !isGameOver; }
  16. public System.Action onGameStart;
  17. public UserGameAnalyse1 userGameAnalyse1;
  18. void Awake()
  19. {
  20. Instance = this;
  21. dogObject.SetActive(true);
  22. if (!AutoNextLevel)
  23. {
  24. //如果调试页面存在,使用duckHunterLevel
  25. DefaultLevel = InfraredDemo._ins ? (int)InfraredDemo._ins.duckHunterLevel.Get(): 1;
  26. _CumulativeScore = 0;
  27. }
  28. level = DefaultLevel;
  29. uploadScore = 0;
  30. }
  31. void OnDestroy()
  32. {
  33. if (Instance == this) Instance = null;
  34. }
  35. void Start()
  36. {
  37. TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.GAME_START);
  38. if (AutoNextLevel)
  39. {
  40. AutoNextLevel = false;
  41. StartGame(true);
  42. }
  43. userGameAnalyse1 = UserGameAnalyse1.CreateWhenGameStartAndReturn(13);
  44. }
  45. void Update()
  46. {
  47. UpdateCheckMouseHit();
  48. UpdateForAutoCreateDucks();
  49. SettleGame();
  50. #if UNITY_EDITOR
  51. if (Input.GetKeyDown(KeyCode.A))
  52. {
  53. Time.timeScale = 10;
  54. }
  55. if (Input.GetKeyUp(KeyCode.A))
  56. {
  57. Time.timeScale = 1;
  58. }
  59. #endif
  60. }
  61. void UpdateCheckMouseHit()
  62. {
  63. if (Input.GetMouseButtonDown(0) && BowCamera.isTouchMode)
  64. {
  65. if (EventSystem.current.currentSelectedGameObject == null)
  66. {
  67. CrossHair.Instance.transform.position = Input.mousePosition;
  68. #if UNITY_EDITOR
  69. bool isAdd = true;
  70. #else
  71. bool isAdd = false;
  72. #endif
  73. OnModuleShooting(10, isAdd);
  74. }
  75. }
  76. }
  77. /// <summary>
  78. /// 基础初速度
  79. /// </summary>
  80. public static float BaseFlySpeed = 50;
  81. /// <summary>
  82. /// 下次从多少分开始
  83. /// </summary>
  84. public static int DefaultLevel = 1;
  85. private static bool AutoNextLevel = false;
  86. [System.NonSerialized] public int hitScore; //得分
  87. private int uploadScore;//上传服务器的分数
  88. private bool bAddCountScore = false;
  89. [System.NonSerialized] public int level = 1;
  90. /// <summary>
  91. /// 通关需要击落的鸭子数量
  92. /// </summary>
  93. int passNeedHitCount;
  94. int needCreateDuckCount;
  95. bool canCreateDuck;
  96. [System.NonSerialized] public int theDuckCountWaitingForDogHandle;
  97. float _createDuckInterval;
  98. void UpdateForAutoCreateDucks()
  99. {
  100. if (isGameOver) return;
  101. if (!canCreateDuck) return;
  102. _createDuckInterval = 0;
  103. if (level <= 9)//60
  104. {
  105. if (theDuckCountWaitingForDogHandle > 0) return;
  106. }
  107. else if (level <= 13)//80
  108. {
  109. if (theDuckCountWaitingForDogHandle > 0) _createDuckInterval = 5;
  110. if (theDuckCountWaitingForDogHandle > 1) return;
  111. }
  112. else //<=100
  113. {
  114. if (theDuckCountWaitingForDogHandle > 0) _createDuckInterval = 5;
  115. if (theDuckCountWaitingForDogHandle > 2) return;
  116. }
  117. if (!Dog.Instance || Dog.Instance.isShowing) return;
  118. if (Time.time - _lastCreateDuckTime < _createDuckInterval) return;
  119. CreateDuck();
  120. }
  121. List<int> _ductTypeList = null;
  122. /// <summary>
  123. /// 生成野鸭,并且打乱数组
  124. /// </summary>
  125. /// <param name="greenCount">绿色数量</param>
  126. /// <param name="blueCount">蓝色数量</param>
  127. /// <param name="redCount">红色数量</param>
  128. void InitDuckTypeList(int greenCount, int blueCount, int redCount)
  129. {
  130. if (_ductTypeList != null) return;
  131. _ductTypeList = new List<int>();
  132. for (int i = 0; i < greenCount; i++) _ductTypeList.Add(1);
  133. for (int i = 0; i < blueCount; i++) _ductTypeList.Add(4);//2
  134. for (int i = 0; i < redCount; i++) _ductTypeList.Add(3);
  135. _ductTypeList.Sort((a, b) => Random.value < 0.5 ? -1 : 1);
  136. needCreateDuckCount = _ductTypeList.Count;
  137. }
  138. static float[] _FlyAngles1 = { 75, 180 - 75 };
  139. static float[] _FlyAngles2 = { 75, 60, 180 - 75, 180 - 60 };
  140. static float[] _FlyAngles3 = { 45, 60, 180 - 45, 180 - 60 };
  141. static float[] _FlyAngles4 = { 30, 45, 60, 180 - 30, 180 - 45, 180 - 60 };
  142. static float RangeFlyAngle(float[] angles)
  143. {
  144. return angles[Random.Range(0, angles.Length)];
  145. }
  146. DuckConfig GetDuckConfig()
  147. {
  148. DuckConfig duckConfig = new DuckConfig();
  149. if (level <= 20) duckConfig.positionX = Random.Range(duckBox.rect.width / 2 - 200, duckBox.rect.width / 2 + 50);
  150. else duckConfig.positionX = Random.Range(250, duckBox.rect.width - 350);
  151. // ● 三关,每关至少击中6只野鸭,同屏1只
  152. // ● 遇到4次边框未被击中
  153. // ● 三箭(枪)用尽未被击中
  154. // ● 绿色野鸭
  155. if (level <= 3)//10
  156. {
  157. InitDuckTypeList(10, 0, 0);
  158. passNeedHitCount = 6;
  159. duckConfig.touchBoundCount = 4;
  160. duckConfig.flyAngle = RangeFlyAngle(_FlyAngles1);
  161. }
  162. // ● 三关,每关至少击中7只野鸭,同屏1只
  163. // ● 遇到5次边框未被击中
  164. // ● 三箭(枪)用尽未被击中
  165. // ● 蓝色野鸭
  166. else if (level <= 6)//15
  167. {
  168. InitDuckTypeList(0, 10, 0);// InitDuckTypeList(5, 5, 0);
  169. passNeedHitCount = 7;
  170. duckConfig.touchBoundCount = 5;
  171. duckConfig.flyAngle = RangeFlyAngle(_FlyAngles1);
  172. }
  173. // ● 三关,每关至少击中8只野鸭,同屏1只
  174. // ● 遇到6次边框未被击中
  175. // ● 三箭(枪)用尽未被击中
  176. // ● 红色野鸭
  177. else if (level <= 9)//18
  178. {
  179. InitDuckTypeList(0, 0, 10);//InitDuckTypeList(5, 3, 2);
  180. passNeedHitCount = 8;
  181. duckConfig.touchBoundCount = 6;
  182. duckConfig.flyAngle = RangeFlyAngle(_FlyAngles1);
  183. }
  184. // ● 两关,每关至少击中9只野鸭,同屏2只,第二只5秒
  185. // ● 遇到7次边框未被击中
  186. // ● 三箭(枪)用尽未被击中
  187. // ● 绿 ,蓝野鸭
  188. else if (level <= 11)
  189. {
  190. InitDuckTypeList(5, 5, 0);
  191. passNeedHitCount = 9;
  192. duckConfig.touchBoundCount = 7;
  193. duckConfig.flyAngle = RangeFlyAngle(_FlyAngles1);
  194. }
  195. // ● 两关,每关至少击中9只野鸭,同屏2只,第二只5秒
  196. // ● 遇到7次边框未被击中
  197. // ● 三箭(枪)用尽未被击中
  198. // ● 蓝,红野鸭
  199. else if (level <= 13)
  200. {
  201. InitDuckTypeList(0, 5, 5);
  202. passNeedHitCount = 9;
  203. duckConfig.touchBoundCount = 7;
  204. duckConfig.flyAngle = RangeFlyAngle(_FlyAngles1);
  205. }
  206. // ● 14-20关,每关至少击中10只野鸭,同屏3只,第二只5秒,第三只10秒。
  207. // ● 遇到8次边框未被击中
  208. // ● 三箭(枪)用尽未被击中
  209. // ● 绿、蓝、红野鸭
  210. else
  211. {
  212. InitDuckTypeList(3, 4, 3);
  213. passNeedHitCount = 10;
  214. duckConfig.touchBoundCount = 8;
  215. duckConfig.flyAngle = RangeFlyAngle(_FlyAngles2);
  216. }
  217. //else if (level <= 60)
  218. //{
  219. // InitDuckTypeList(3, 3, 4);
  220. // passNeedHitCount = 10;
  221. // duckConfig.touchBoundCount = 6;
  222. // duckConfig.flyAngle = RangeFlyAngle(_FlyAngles3);
  223. //}
  224. //else if (level <= 80)
  225. //{
  226. // InitDuckTypeList(2, 4, 4);
  227. // passNeedHitCount = 10;
  228. // duckConfig.touchBoundCount = 7;
  229. // duckConfig.flyAngle = RangeFlyAngle(_FlyAngles4);
  230. //}
  231. //else if (level <= 100)
  232. //{
  233. // InitDuckTypeList(2, 3, 5);
  234. // passNeedHitCount = 10;
  235. // duckConfig.touchBoundCount = 8;
  236. // duckConfig.flyAngle = RangeFlyAngle(_FlyAngles4);
  237. //}
  238. duckConfig.type = _ductTypeList[0]; _ductTypeList.RemoveAt(0);
  239. //duckConfig.flySpeed = BaseFlySpeed * (1 + (level - 1) * 0.05f);
  240. //2023-7-25修改:速度还是以80关的做为初始速度,后面的关卡再按原来的公式增加
  241. duckConfig.flySpeed = BaseFlySpeed * (1 + (level + 79 - 1) * 0.05f);
  242. if (duckConfig.type == 1) duckConfig.flySpeed *= 1f;
  243. else if (duckConfig.type == 4) duckConfig.flySpeed *= 1.2f; //duckConfig.type == 2
  244. else if (duckConfig.type == 3) duckConfig.flySpeed *= 1.5f;
  245. return duckConfig;
  246. }
  247. float _lastCreateDuckTime = -1000;
  248. void CreateDuck()
  249. {
  250. if (_ductTypeList != null && _ductTypeList.Count == 0) return;
  251. theDuckCountWaitingForDogHandle++;
  252. _lastCreateDuckTime = Time.time;
  253. DuckConfig duckConfig = GetDuckConfig();
  254. Duck duck = Instantiate(duckPrefab, duckBox).GetComponent<Duck>();
  255. duck.config = duckConfig;
  256. duck.onExit += HandleOnDuckExit;
  257. duck.onFallDonwEnd += HandleOnDuckFallDown;
  258. duck.onHitDead += HandleOnHitDead;
  259. duck.onStartFlyAway += () => TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.FLY_AWAY);
  260. //恢复箭
  261. ResumeArrows(duck);
  262. }
  263. int exitDuckCount = 0;
  264. void HandleOnDuckExit(Duck duck)
  265. {
  266. if (duck.dead) Dog.Instance?.OnEvent(Dog.SensitiveEventType.DuckHit, duck);
  267. else
  268. {
  269. RemoveArrows(duck);
  270. GameUI.Instance.RenderHitDuckCount(0);
  271. Dog.Instance?.OnEvent(Dog.SensitiveEventType.DuckGetAway);
  272. }
  273. exitDuckCount++;
  274. }
  275. float _lastFallDownTime = 0;
  276. void HandleOnDuckFallDown(Duck duck)
  277. {
  278. _lastFallDownTime = Time.time;
  279. }
  280. [System.NonSerialized] public int hitCount = 0;
  281. private int bowHitCount = 0;
  282. void HandleOnHitDead(Duck duck)
  283. {
  284. hitCount++;
  285. int scoreToPlus = duck.config.type * 500;
  286. hitScore += scoreToPlus;
  287. GameUI.Instance.RenderHitDuckCount(duck.config.type);
  288. //射击状态下,刷新添加分数
  289. if (bAddCountScore) {
  290. bowHitCount++;
  291. _CumulativeScore += scoreToPlus;
  292. uploadScore += scoreToPlus; //击杀野鸭分数
  293. GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
  294. GameUI.Instance.ShowTextHitScore(scoreToPlus, duck.transform.position);
  295. }
  296. RemoveArrows(duck);
  297. }
  298. public void OnModuleRotationUpdate(Quaternion rotation)
  299. {
  300. CrossHair.Instance?.UpdatePositionByModuleRotation(rotation);
  301. }
  302. public void OnModuleShooting(float speed, bool bAddCount = false)
  303. {
  304. if (CrossHair.Instance)
  305. {
  306. if (isGamePlaying)
  307. {
  308. if (UseOneArrow(bAddCount))
  309. {
  310. CrossHair.Instance.Shoot();
  311. CheckShootPointHitDuck();
  312. CheckNotifyFlyAway();
  313. }
  314. }
  315. else if (!isGameStarted)
  316. {
  317. //CrossHair.Instance.Shoot();
  318. if (GameUI.Instance.CheckHitDuckForGameStart(CrossHair.Instance.transform.position))
  319. {
  320. OnClick_GameStart();
  321. }
  322. }
  323. }
  324. }
  325. void CheckShootPointHitDuck()
  326. {
  327. bool hitDuck = false;
  328. Vector2 aimPos = CrossHair.Instance.transform.position;
  329. for (int i = Duck.DuckList.Count - 1; i >= 0; i--)
  330. {
  331. Duck duck = Duck.DuckList[i];
  332. RectTransform duckRTF = duck.transform as RectTransform;
  333. bool intersect = RectTransformUtility.RectangleContainsScreenPoint(duckRTF, aimPos);
  334. bool hitFrontBG = false;
  335. Collider2D[] hitColliders = Physics2D.OverlapPointAll(aimPos);
  336. foreach (var item in hitColliders)
  337. {
  338. if (item.name.StartsWith("BGFront"))
  339. {
  340. hitFrontBG = true;
  341. break;
  342. }
  343. }
  344. if (intersect && !hitFrontBG && duck.Hit())
  345. {
  346. hitDuck = true;
  347. break;
  348. }
  349. }
  350. if (!hitDuck)
  351. {
  352. GameUI.Instance.AddArrowOnScreen(aimPos);
  353. }
  354. else {
  355. //枪械模式下,射中也加个效果
  356. if(GlobalData.MyDeviceMode == DeviceMode.Gun)
  357. {
  358. GameUI.Instance.AddArrowOnScreen(aimPos);
  359. }
  360. }
  361. }
  362. void OnClick_GameStart()
  363. {
  364. AudioManager.Instance.PlayGameStart();
  365. StartGame(false);
  366. }
  367. void StartGame(bool startImmediate)
  368. {
  369. if (isGameStarted) return;
  370. isGameStarted = true;
  371. onGameStart?.Invoke();
  372. GameUI.Instance.HandleGameStart(() =>
  373. {
  374. dogSideObject.SetActive(true);
  375. dogSideObject.GetComponent<DogSide>().onExit = () => canCreateDuck = true;
  376. TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.ROUND_X, new object[] { level });
  377. }, startImmediate);
  378. NoArrows();
  379. GameUI.Instance.RenderLevel(level);
  380. // GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
  381. GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
  382. }
  383. void SettleGame()
  384. {
  385. if (isGameOver) return;
  386. if (_ductTypeList == null) return;
  387. if (Dog.Instance != null && Dog.Instance.isShowing) return;
  388. if (needCreateDuckCount != exitDuckCount) return;
  389. isGameOver = true;
  390. Debug.Log("Game Over");
  391. GameUI.Instance.RenderHitDuckCount(-1);
  392. if (hitCount < passNeedHitCount)
  393. {
  394. //通关失败
  395. TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.GAME_OVER, null, () =>
  396. {
  397. //UnityEngine.SceneManagement.SceneManager.LoadScene("DuckHunter");
  398. //失败时候也时候弹出排行榜
  399. UploadBestScoreToLocalRank(() => {
  400. UnityEngine.SceneManagement.SceneManager.LoadScene("DuckHunter");
  401. });
  402. });
  403. AudioManager.Instance.PlayGameOver();
  404. Debug.Log("通关失败");
  405. }
  406. else
  407. {
  408. //完美通关
  409. if (needCreateDuckCount == hitCount && needCreateDuckCount == bowHitCount)
  410. {
  411. //奖励额外积分
  412. int plusScore = 10000;
  413. hitScore += plusScore;
  414. _CumulativeScore += plusScore;
  415. uploadScore += plusScore;
  416. GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
  417. TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.SUPER_ARCHER, new object[] { plusScore }, ShowGamePass);
  418. AudioManager.Instance.PlayFullScore();
  419. }
  420. else
  421. {
  422. ShowGamePass();
  423. }
  424. }
  425. //通过关卡时候,上传一次分数
  426. onUploadScore();
  427. SaveBestScore();
  428. GameOverInterface.OnGameOver(GameMgr.gameType);
  429. }
  430. //野鸭退出时候保存分数到服务器
  431. public void onUploadScore()
  432. {
  433. //uploadScore = 500;
  434. if (uploadScore > 0)
  435. {
  436. Debug.Log("野鸭上传的积分为:" + uploadScore);
  437. RankComp.Instance.uploadSinglePlayerGameRes(uploadScore);
  438. uploadScore = 0;
  439. }
  440. }
  441. void ShowGamePass()
  442. {
  443. //通关成功
  444. TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.GAME_COMPLETED, null, () =>
  445. {
  446. //自动进入下一关
  447. if (level < 20)
  448. {
  449. DefaultLevel = level + 1;
  450. AutoNextLevel = true;
  451. //小于20,就是未完全通关
  452. UnityEngine.SceneManagement.SceneManager.LoadScene("DuckHunter");
  453. }
  454. else {
  455. //完全通过时候弹出排行榜
  456. UploadBestScoreToLocalRank(() => {
  457. UnityEngine.SceneManagement.SceneManager.LoadScene("DuckHunter");
  458. });
  459. }
  460. Debug.Log("野鸭跳转关卡:"+ DefaultLevel);
  461. //UnityEngine.SceneManagement.SceneManager.LoadScene("DuckHunter");
  462. });
  463. AudioManager.Instance.PlayGamePass();
  464. Debug.Log("通关成功");
  465. }
  466. /// <summary>
  467. /// 把累计得分记录到本地数据库
  468. /// </summary>
  469. public void UploadBestScoreToLocalRank(System.Action callback) {
  470. if (CommonConfig.StandaloneModeOrPlatformB)
  471. {
  472. //获取当前记录的最高分数
  473. LocalRank.RankManager.SetCurrentScore(_CumulativeScore);
  474. LocalRank.RankManager.CreateRankView(GlobalData.singlePlayerGameType, callback);
  475. }
  476. else
  477. {
  478. callback?.Invoke();
  479. }
  480. }
  481. int _arrowCount;
  482. int arrowCount
  483. {
  484. get
  485. {
  486. // int count = 0;
  487. // _duckCanShootCountList.ForEach(e => count += e.shootCount);
  488. // return count;
  489. return _arrowCount;
  490. }
  491. }
  492. List<DuckCanShootCount> _duckCanShootCountList = new List<DuckCanShootCount>();
  493. class DuckCanShootCount
  494. {
  495. public Duck duck;
  496. public int shootCount;
  497. public DuckCanShootCount(Duck duck, int shootCount)
  498. {
  499. this.duck = duck;
  500. this.shootCount = shootCount;
  501. }
  502. }
  503. void ResumeArrows(Duck duck)
  504. {
  505. // _duckCanShootCountList.Add(new DuckCanShootCount(duck, 3));
  506. _arrowCount = 3;
  507. GameUI.Instance.RenderArrowCount(arrowCount);
  508. }
  509. void RemoveArrows(Duck duck)
  510. {
  511. // _duckCanShootCountList.RemoveAll(e => e.duck == duck);
  512. // GameUI.Instance.RenderArrowCount(arrowCount);
  513. }
  514. bool UseOneArrow(bool bAddCount = false)
  515. {
  516. //根据射箭状态赋值
  517. bAddCountScore = bAddCount;
  518. if (arrowCount > 0)
  519. {
  520. // foreach (var e in _duckCanShootCountList)
  521. // {
  522. // if (e.shootCount > 0)
  523. // {
  524. // e.shootCount--;
  525. // break;
  526. // }
  527. // }
  528. if (bAddCount) userGameAnalyse1.changeShootingCount(1);
  529. _arrowCount--;
  530. GameUI.Instance.RenderArrowCount(arrowCount);
  531. return true;
  532. }
  533. return false;
  534. }
  535. void NoArrows()
  536. {
  537. // _duckCanShootCountList = new List<DuckCanShootCount>();
  538. _arrowCount = 0;
  539. GameUI.Instance.RenderArrowCount(arrowCount);
  540. }
  541. void CheckNotifyFlyAway()
  542. {
  543. // foreach (var e in _duckCanShootCountList)
  544. // if (e.shootCount == 0)
  545. // e.duck.NotifyFlyAway();
  546. if (arrowCount <= 0)
  547. foreach (var duck in Duck.DuckList)
  548. duck.NotifyFlyAway();
  549. }
  550. //累计得分
  551. private static int _CumulativeScore = 0;
  552. private static int _BestScoreVersion = 1;
  553. string GetBestScoreKey()
  554. {
  555. // return "BestScore_Level" + level + "_V" + _BestScoreVersion;
  556. return "DuckHunter_" + LoginMgr.myUserInfo.id + "_" + _BestScoreVersion;
  557. }
  558. void SaveBestScore()
  559. {
  560. string k = GetBestScoreKey();
  561. int s = PlayerPrefs.GetInt(k, 0);
  562. // if (hitScore > s) PlayerPrefs.SetInt(k, hitScore);
  563. if (_CumulativeScore > s) PlayerPrefs.SetInt(k, _CumulativeScore);
  564. }
  565. int GetBestScore()
  566. {
  567. string k = GetBestScoreKey();
  568. int s = PlayerPrefs.GetInt(k, 0);
  569. return s;
  570. }
  571. }
  572. }