|
|
@@ -22,6 +22,11 @@ namespace DuckHunter
|
|
|
{
|
|
|
Instance = this;
|
|
|
dogObject.SetActive(true);
|
|
|
+ if (!AutoNextLevel)
|
|
|
+ {
|
|
|
+ DefaultLevel = 1;
|
|
|
+ _CumulativeScore = 0;
|
|
|
+ }
|
|
|
level = DefaultLevel;
|
|
|
}
|
|
|
|
|
|
@@ -249,7 +254,9 @@ namespace DuckHunter
|
|
|
int scoreToPlus = duck.config.type * 500;
|
|
|
hitScore += scoreToPlus;
|
|
|
GameUI.Instance.RenderHitDuckCount(duck.config.type);
|
|
|
- GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
|
|
|
+ // GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
|
|
|
+ _CumulativeScore += scoreToPlus;
|
|
|
+ GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
|
|
|
GameUI.Instance.ShowTextHitScore(scoreToPlus, duck.transform.position);
|
|
|
RemoveArrows(duck);
|
|
|
}
|
|
|
@@ -325,7 +332,8 @@ namespace DuckHunter
|
|
|
}, startImmediate);
|
|
|
NoArrows();
|
|
|
GameUI.Instance.RenderLevel(level);
|
|
|
- GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
|
|
|
+ // GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
|
|
|
+ GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
|
|
|
}
|
|
|
|
|
|
void SettleGame()
|
|
|
@@ -356,7 +364,9 @@ namespace DuckHunter
|
|
|
//奖励额外积分
|
|
|
int plusScore = 10000;
|
|
|
hitScore += plusScore;
|
|
|
- GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
|
|
|
+ // GameUI.Instance.RenderHitScore(hitScore, GetBestScore());
|
|
|
+ _CumulativeScore += plusScore;
|
|
|
+ GameUI.Instance.RenderHitScore(_CumulativeScore, GetBestScore());
|
|
|
TextGameScreenCenter.Instance.ShowText(TextGameScreenCenter.TextName.SUPER_ARCHER, new object[] { plusScore }, ShowGamePass);
|
|
|
AudioManager.Instance.PlayFullScore();
|
|
|
}
|
|
|
@@ -385,14 +395,15 @@ namespace DuckHunter
|
|
|
AudioManager.Instance.PlayGamePass();
|
|
|
Debug.Log("通关成功");
|
|
|
}
|
|
|
-
|
|
|
+ int _arrowCount;
|
|
|
int arrowCount
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- int count = 0;
|
|
|
- _duckCanShootCountList.ForEach(e => count += e.shootCount);
|
|
|
- return count;
|
|
|
+ // int count = 0;
|
|
|
+ // _duckCanShootCountList.ForEach(e => count += e.shootCount);
|
|
|
+ // return count;
|
|
|
+ return _arrowCount;
|
|
|
}
|
|
|
}
|
|
|
List<DuckCanShootCount> _duckCanShootCountList = new List<DuckCanShootCount>();
|
|
|
@@ -408,27 +419,29 @@ namespace DuckHunter
|
|
|
}
|
|
|
void ResumeArrows(Duck duck)
|
|
|
{
|
|
|
- _duckCanShootCountList.Add(new DuckCanShootCount(duck, 3));
|
|
|
+ // _duckCanShootCountList.Add(new DuckCanShootCount(duck, 3));
|
|
|
+ _arrowCount = 3;
|
|
|
GameUI.Instance.RenderArrowCount(arrowCount);
|
|
|
}
|
|
|
void RemoveArrows(Duck duck)
|
|
|
{
|
|
|
- _duckCanShootCountList.RemoveAll(e => e.duck == duck);
|
|
|
- GameUI.Instance.RenderArrowCount(arrowCount);
|
|
|
+ // _duckCanShootCountList.RemoveAll(e => e.duck == duck);
|
|
|
+ // GameUI.Instance.RenderArrowCount(arrowCount);
|
|
|
}
|
|
|
|
|
|
bool UseOneArrow()
|
|
|
{
|
|
|
if (arrowCount > 0)
|
|
|
{
|
|
|
- foreach (var e in _duckCanShootCountList)
|
|
|
- {
|
|
|
- if (e.shootCount > 0)
|
|
|
- {
|
|
|
- e.shootCount--;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ // foreach (var e in _duckCanShootCountList)
|
|
|
+ // {
|
|
|
+ // if (e.shootCount > 0)
|
|
|
+ // {
|
|
|
+ // e.shootCount--;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ _arrowCount--;
|
|
|
GameUI.Instance.RenderArrowCount(arrowCount);
|
|
|
return true;
|
|
|
}
|
|
|
@@ -437,27 +450,35 @@ namespace DuckHunter
|
|
|
|
|
|
void NoArrows()
|
|
|
{
|
|
|
- _duckCanShootCountList = new List<DuckCanShootCount>();
|
|
|
+ // _duckCanShootCountList = new List<DuckCanShootCount>();
|
|
|
+ _arrowCount = 0;
|
|
|
GameUI.Instance.RenderArrowCount(arrowCount);
|
|
|
}
|
|
|
|
|
|
void CheckNotifyFlyAway()
|
|
|
{
|
|
|
- foreach (var e in _duckCanShootCountList)
|
|
|
- if (e.shootCount == 0)
|
|
|
- e.duck.NotifyFlyAway();
|
|
|
+ // foreach (var e in _duckCanShootCountList)
|
|
|
+ // if (e.shootCount == 0)
|
|
|
+ // e.duck.NotifyFlyAway();
|
|
|
+ if (arrowCount <= 0)
|
|
|
+ foreach (var duck in Duck.DuckList)
|
|
|
+ duck.NotifyFlyAway();
|
|
|
}
|
|
|
|
|
|
+ //累计得分
|
|
|
+ private static int _CumulativeScore = 0;
|
|
|
private static int _BestScoreVersion = 1;
|
|
|
string GetBestScoreKey()
|
|
|
{
|
|
|
- return "BestScore_Level" + level + "_V" + _BestScoreVersion;
|
|
|
+ // return "BestScore_Level" + level + "_V" + _BestScoreVersion;
|
|
|
+ return "DuckHunter_" + LoginMgr.myUserInfo.id + "_" + _BestScoreVersion;
|
|
|
}
|
|
|
void SaveBestScore()
|
|
|
{
|
|
|
string k = GetBestScoreKey();
|
|
|
int s = PlayerPrefs.GetInt(k, 0);
|
|
|
- if (hitScore > s) PlayerPrefs.SetInt(k, hitScore);
|
|
|
+ // if (hitScore > s) PlayerPrefs.SetInt(k, hitScore);
|
|
|
+ if (_CumulativeScore > s) PlayerPrefs.SetInt(k, _CumulativeScore);
|
|
|
}
|
|
|
int GetBestScore()
|
|
|
{
|