public void Gain(NodeCountInfo nodeCount) { if (nodeCount.nodes != 0) { float tempRegain; tempRegain = nodeCount.nodes * feverInfo.gainRatio; tempRegain *= 1.0f + nodeCount.nodes * feverInfo.gainPerCap; tempRegain *= 1.0f + nodeCount.path2 * feverInfo.gainPerPath2; tempRegain *= 1.0f + nodeCount.path3 * feverInfo.gainPerPath3; tempRegain *= 1.0f + nodeCount.path4 * feverInfo.gainPerPath4; if (tempRegain > feverInfo.MaxGainRatio) tempRegain = feverInfo.MaxGainRatio; feverValue += nextGain; if (feverValue > GAUGE_MAX) { feverValue = GAUGE_MAX; if(feverState == _eFeverState.NORMAL) ChangeState(_eFeverState.FEVER); } nextGain = tempRegain; //feverValue += tempRegain; StartCoroutine(WaitGain(() => { feverValue += nextGain; FGImage.DOKill(); FGImage.DOFillAmount(feverValue,gainDuration); nextGain = 0; if (feverValue > GAUGE_MAX) { feverValue = GAUGE_MAX; if(feverState == _eFeverState.NORMAL) ChangeState(_eFeverState.FEVER); } audioSource.Play(); })); } //MAXになったらフィーバーモードへ //今はとりあえず0に戻す //audioSource.Play(); if (_feverState == _eFeverState.FEVER) return; }
//計算機構 public int PlusScore(NodeCountInfo nodeCount) { //ツムツム方式で得点計算をしてみる float tempScore = 0; for (int i = 1; i < nodeCount.nodes + 1; i++) //ベースポイントを100とすると、 tempScore += scoreInfo.BasePoint * i; //100 + 200 + 300 + ... + (100 * 連鎖数) tempScore *= (1.0f + scoreInfo.BonusPerCap * nodeCount.cap); //各ノードごとの tempScore *= (1.0f + scoreInfo.BonusPer2Path * nodeCount.path2); //ボーナスポイントを tempScore *= (1.0f + scoreInfo.BonusPer3Path * nodeCount.path3); //ツムツムでは加算していたが、 tempScore *= (1.0f + scoreInfo.BonusPer4Path * nodeCount.path4); //分岐の重みを増やすために乗算に preGainScore = (int)tempScore; //とりあえずフィーバー中はポイント3倍点 tempScore *= feverGauge.feverState == _eFeverState.FEVER ? 3 : 1; gameScore += (int)tempScore; SetScore(); return (int)tempScore; }
//枝の数と種類をもらって時間を割合で回復させる public void PlusTime(NodeCountInfo nodeCount) { //計算 float tempRatio = 0.0f; //最大値を超えていたらカット //ノード3つ毎に1割増える 3分岐1つ毎に5分増える tempRatio = (float)nodeCount.nodes * timeLevel.RegainPerNodes //ノード1つごとに数% + (float)nodeCount.cap * timeLevel.RegainPerCap //1パスのノード1つ毎に数% + (float)nodeCount.path2 * timeLevel.RegainPer2Path //2パスのノード1つ毎に数% + (float)nodeCount.path3 * timeLevel.RegainPer3Path //3パスのノード1つ毎に数% + (float)nodeCount.path3 * timeLevel.RegainPer4Path; //最大値以上は回復しない if (tempRatio > timeLevel.MaxRegainRatio) tempRatio = timeLevel.MaxRegainRatio; //nowTime -= maxTime * tempRatio; nowTime -= nextGain; if (nowTime < 0) nowTime = 0; nextGain = maxTime * tempRatio; StartCoroutine(WaitGain(() => { timeImage.DOKill(); timeImage.DOFillAmount(lastRate,fillWaitTime); // changedValueTime = Time.frameCount; nowTime -= nextGain; if (nowTime < 0) nowTime = 0; nextGain = 0; })); }
//完成した枝に使用しているノードを再配置する void ReplaceNodeTree(List<Node> List) { //Log.Debug("ReplaceNodeTree : " + List); if (List.Count > 2) { FinishNodeList.Add(FinNode.Convert(List)); //#if UNITY_EDITOR // if(List.Count > 3) // { // NodeSaver.Write(FinNode.Convert(List)); // } //#endif } NodeCountInfo nodeCount = new NodeCountInfo(); foreach (Node obj in List) { switch (obj.GetLinkNum()) { case 1: nodeCount.cap++; break; case 2: nodeCount.path2++; break; case 3: nodeCount.path3++; break; case 4: nodeCount.path4++; break; } } int curScore = 0; nodeCount.nodes = List.Count; curScore = scoreScript.PlusScore(nodeCount); timeScript.PlusTime(nodeCount); feverScript.Gain(nodeCount); // 完成時演出 gameEffect.TreeCompleteEffect(List, curScore); audioSources[(int)_eAudioNumber.TREE].Play(); //ノードを再配置 foreach (Node obj in List) { ReplaceNode(obj, obj.NodeID.y < 2); } foreach (Node obj in List) { obj.UpdateNegibor(); } CheckLink(true, true); }