// サイズ揃えは揃った分だけ効果アップ private void CalculateSizeSpecial(ScoreData score) { int straightNum = 0; for (int type = 0; type < _fishList.Length; type++) { bool isStraight = true; for (int size = 0; size < _fishList[0].Length; size++) { if (_fishList[type][size] <= 0) { isStraight = false; break; } } if (isStraight) { ++straightNum; } } Debug.Assert(0 <= straightNum && straightNum <= Enum.GetValues(typeof(FishType)).Length); if (0 < straightNum) { score._sizeSpecial = SpecialInfo.Straight(straightNum); } }
private void CalculateToroSpecial(ScoreData score) { if (0 < _fishList[(int)FishType.maguro][(int)SizeType.Large] && 0 < _fishList[(int)FishType.sake][(int)SizeType.Large] && 0 < _fishList[(int)FishType.mekaziki][(int)SizeType.Large]) { score._toroSpecial = SpecialInfo.BigToro3Kan(); return; } if (0 < _fishList[(int)FishType.maguro][(int)SizeType.Medium] && 0 < _fishList[(int)FishType.sake][(int)SizeType.Medium] && 0 < _fishList[(int)FishType.mekaziki][(int)SizeType.Medium]) { score._toroSpecial = SpecialInfo.MidiumToro3Kan(); return; } if (0 < _fishList[(int)FishType.maguro][(int)SizeType.Small] && 0 < _fishList[(int)FishType.maguro][(int)SizeType.Small] && 0 < _fishList[(int)FishType.sake][(int)SizeType.Small]) { score._toroSpecial = SpecialInfo.SmallToro3Kan(); return; } }
private void SetColorScore(ScoreData scoreData) { for (int i = 0; i < _colorPanel.Count; i++) { Debug.Assert(_colorPanel.Count == scoreData._colorGetList.Length); _colorPanel[i].SetActive(scoreData._colorGetList[i]); } _colorScore.SetText(scoreData._colorScore.ToString()); }
private void CalculateMunielSpecial(ScoreData score) { int[] sake = _fishList[(int)FishType.sake]; int[] mekaziki = _fishList[(int)FishType.mekaziki]; if (3 <= sake[(int)SizeType.Large] + _fishList[(int)FishType.sake][(int)SizeType.Medium] + _fishList[(int)FishType.sake][(int)SizeType.Small] && 3 <= mekaziki[(int)SizeType.Large] + _fishList[(int)FishType.mekaziki][(int)SizeType.Medium] + _fishList[(int)FishType.mekaziki][(int)SizeType.Small]) { score._toroSpecial = SpecialInfo.MunielRush(); return; } }
private void CalculateTunaSpecial(ScoreData score) { int[] maguro = _fishList[(int)FishType.maguro]; int[] mekaziki = _fishList[(int)FishType.mekaziki]; if (3 <= maguro[(int)SizeType.Large] + _fishList[(int)FishType.maguro][(int)SizeType.Medium] + _fishList[(int)FishType.maguro][(int)SizeType.Small] && 3 <= mekaziki[(int)SizeType.Large] + _fishList[(int)FishType.mekaziki][(int)SizeType.Medium] + _fishList[(int)FishType.mekaziki][(int)SizeType.Small]) { score._toroSpecial = SpecialInfo.TunaRush(); return; } }
private void CalculateTatakiSpecial(ScoreData score) { int[] katsuo = _fishList[(int)FishType.katsuo]; int[] maguro = _fishList[(int)FishType.maguro]; int[] sake = _fishList[(int)FishType.sake]; if ((0 < katsuo[(int)SizeType.Large] && 0 < maguro[(int)SizeType.Large] && 0 < sake[(int)SizeType.Large]) || (0 < katsuo[(int)SizeType.Medium] && 0 < maguro[(int)SizeType.Medium] && 0 < sake[(int)SizeType.Medium]) || (0 < katsuo[(int)SizeType.Small] && 0 < maguro[(int)SizeType.Small] && 0 < sake[(int)SizeType.Small])) { score._tatakiSpecial = SpecialInfo.Tataki3Kind(); } }
private void SetFishScores(ScoreData scoreData) { for (int i = 0; i < _fishScoreS.Count; i++) { Debug.Assert(_fishScoreS.Count == scoreData._fishSNumList.Length); _fishScoreS[i].SetText(scoreData._fishSNumList[i].ToString()); } for (int i = 0; i < _fishScoreM.Count; i++) { Debug.Assert(_fishScoreM.Count == scoreData._fishMNumList.Length); _fishScoreM[i].SetText(scoreData._fishMNumList[i].ToString()); } for (int i = 0; i < _fishScoreL.Count; i++) { Debug.Assert(_fishScoreL.Count == scoreData._fishLNumList.Length); _fishScoreL[i].SetText(scoreData._fishLNumList[i].ToString()); } for (int i = 0; i < _fishScoreSum.Count; i++) { Debug.Assert(_fishScoreSum.Count == scoreData._fishScoreSumList.Length); _fishScoreSum[i].SetText(scoreData._fishScoreSumList[i].ToString()); } }
// 捕獲した魚情報からあれこれ計算してスコアを計算する処理 public ScoreData CalculateScore() { var score = new ScoreData(); // 魚の数を反映 Debug.Assert(score._fishSNumList.Length == _fishList.Length, $"{score._fishSNumList.Length} == ${_fishList.Length}"); for (int i = 0; i < score._fishSNumList.Length; i++) { score._fishSNumList[i] = _fishList[i][0]; } Debug.Assert(score._fishMNumList.Length == _fishList.Length, $"{score._fishMNumList.Length} == ${_fishList.Length}"); for (int i = 0; i < score._fishMNumList.Length; i++) { score._fishMNumList[i] = _fishList[i][1]; } Debug.Assert(score._fishLNumList.Length == _fishList.Length, $"{score._fishLNumList.Length} == ${_fishList.Length}"); for (int i = 0; i < score._fishLNumList.Length; i++) { score._fishLNumList[i] = _fishList[i][2]; } // 魚種類ごとの合計スコアを計算して反映 for (int fishType = 0; fishType < _fishList.Length; fishType++) { int scoreSum = 0; for (int sizeType = 0; sizeType < _fishList[0].Length; sizeType++) { scoreSum += kBaseScore[fishType] * (sizeType + 1) * _fishList[fishType][sizeType]; } score._fishScoreSumList[fishType] = scoreSum; } // 色の獲得状況を反映 for (int i = 0; i < score._colorGetList.Length; i++) { score._colorGetList[i] = _colorList[i]; } // 色の獲得状況に応じたスコアを計算して反映 foreach (var isGet in score._colorGetList) { if (isGet) { score._colorScore += kEachColorScore; } } //----------- // 役判定 CalculateColorSpecial(score); CalculateSizeSpecial(score); CalculateToroSpecial(score); CalculateMunielSpecial(score); CalculateTatakiSpecial(score); CalculateTunaSpecial(score); //----------- // 基本スコアを合計 foreach (var fishScore in score._fishScoreSumList) { score._total += fishScore; } score._total += score._colorScore; // 役によるボーナスを反映 float scoreTotalFloat = score._total; scoreTotalFloat *= score._colorSpecial._bonusRate; scoreTotalFloat *= score._sizeSpecial._bonusRate; scoreTotalFloat *= score._toroSpecial._bonusRate; scoreTotalFloat *= score._munielSpecial._bonusRate; scoreTotalFloat *= score._tatakiSpecial._bonusRate; scoreTotalFloat *= score._specialSpecial._bonusRate; score._total = Mathf.RoundToInt(scoreTotalFloat); return(score); }
// 色に関する役は一番効果が高いやつひとつだけ採用 private void CalculateColorSpecial(ScoreData score) { // レインボーALL判定 if (_colorList[(int)ColorType.Blue] && _colorList[(int)ColorType.Yellow] && _colorList[(int)ColorType.Red] && _colorList[(int)ColorType.Green] && _colorList[(int)ColorType.Orange] && _colorList[(int)ColorType.Indigo] && _colorList[(int)ColorType.Violet] && !_colorList[(int)ColorType.White] && !_colorList[(int)ColorType.Gray] && !_colorList[(int)ColorType.Black]) { score._colorSpecial = SpecialInfo.RainbowAll(); return; } // モノクロALL判定 if (!_colorList[(int)ColorType.Blue] && !_colorList[(int)ColorType.Yellow] && !_colorList[(int)ColorType.Red] && !_colorList[(int)ColorType.Green] && !_colorList[(int)ColorType.Orange] && !_colorList[(int)ColorType.Indigo] && !_colorList[(int)ColorType.Violet] && _colorList[(int)ColorType.White] && _colorList[(int)ColorType.Gray] && _colorList[(int)ColorType.Black]) { score._colorSpecial = SpecialInfo.MonochromeAll(); return; } // レインボー判定 if (_colorList[(int)ColorType.Blue] && _colorList[(int)ColorType.Yellow] && _colorList[(int)ColorType.Red] && _colorList[(int)ColorType.Green] && _colorList[(int)ColorType.Orange] && _colorList[(int)ColorType.Indigo] && _colorList[(int)ColorType.Violet]) { score._colorSpecial = SpecialInfo.Rainbow(); return; } // モノクロ判定 if (_colorList[(int)ColorType.White] && _colorList[(int)ColorType.Gray] && _colorList[(int)ColorType.Black]) { score._colorSpecial = SpecialInfo.Monochrome(); return; } // RGB判定 if (_colorList[(int)ColorType.Blue] && _colorList[(int)ColorType.Red] && _colorList[(int)ColorType.Green]) { score._colorSpecial = SpecialInfo.RGB(); return; } // 信号機判定 if ((_colorList[(int)ColorType.Blue] || _colorList[(int)ColorType.Green]) && _colorList[(int)ColorType.Yellow] && _colorList[(int)ColorType.Red]) { score._colorSpecial = SpecialInfo.TrafficLight(); return; } }
private void SetColorSpecial(ScoreData scoreData) { _colorSpecial.SetText(scoreData._colorSpecial._text); }
private void SetSpecialSpecial(ScoreData scoreData) { _specialSpecial.SetText(scoreData._specialSpecial._text); }
private void SetTunaSpecial(ScoreData scoreData) { _tunaSpecial.SetText(scoreData._tunaSpecial._text); }
private void SetTatakiSpecial(ScoreData scoreData) { _tatakiSpecial.SetText(scoreData._tatakiSpecial._text); }
private void SetMunielSpecial(ScoreData scoreData) { _munielSpecial.SetText(scoreData._munielSpecial._text); }
private void SetToroSpecial(ScoreData scoreData) { _toroSpecial.SetText(scoreData._toroSpecial._text); }