public long AddItemRevise(ReviseField reviseField, float reviseValue, ReviseType reviseMode, ComputeMode computeMode, float duration) { long receipt = -1; switch (reviseField) { case ReviseField.MaxSP: receipt = AddItemReviseMaxSP(reviseValue, reviseMode, duration); break; case ReviseField.CurrentSP: ReviseCurrentSP(reviseValue, reviseMode, computeMode); break; case ReviseField.RecoverSP: receipt = AddItemReviseRecoverSP(reviseValue, reviseMode, duration); break; case ReviseField.TimeScale: receipt = AddItemReviseTimeScale(reviseValue, reviseMode, duration); break; } return(receipt); }
private long AddItemReviseRecoverSP(float reviseValue, ReviseType reviseMode, float duration) { long receipt = System.DateTime.Now.ToBinary(); float revise = reviseValue; switch (reviseMode) { case ReviseType.PercentBase: revise = baseRecoverSP * reviseValue; break; case ReviseType.PercentCurrent: revise = recoverSP * reviseValue; break; } receiptItemReviseRecoverSPPairs.Add(receipt, revise); if (duration > 0) { StartCoroutine(IEnumeratorHelper.After(RemoveItemReviseRecoverSP, receipt, duration)); } return(receipt); }
private long AddActivityReviseMaxSP(float reviseValue, ReviseType reviseMode, float duration) { long receipt = System.DateTime.Now.ToBinary(); float revise = reviseValue; switch (reviseMode) { case ReviseType.PercentBase: revise = baseMaxSP * reviseValue; break; case ReviseType.PercentCurrent: revise = maxSP * reviseValue; break; } receiptActivityReviseMaxSPPairs.Add(receipt, revise); MaxSPChangeEvent?.Invoke(maxSP); if (duration > 0) { StartCoroutine(IEnumeratorHelper.After(RemoveActivityReviseMaxSP, receipt, duration)); } return(receipt); }
private long AddItemReviseTimeScale(float reviseValue, ReviseType reviseMode, float duration) { long receipt = System.DateTime.Now.ToBinary(); float revise = reviseValue; switch (reviseMode) { case ReviseType.PercentBase: revise = baseTimeScale * reviseValue; break; case ReviseType.PercentCurrent: revise = timeScale * reviseValue; break; } receiptItemReviseTimeScalePairs.Add(receipt, revise); SetAnimatorSpeed(timeScale); TimeScaleChangeEvent?.Invoke(timeScale); if (duration > 0) { StartCoroutine(IEnumeratorHelper.After(RemoveItemReviseTimeScale, receipt, duration)); } return(receipt); }
private void ReviseCurrentSP(float reviseValue, ReviseType reviseMode, ComputeMode computeMode) { float revise = reviseValue; switch (reviseMode) { case ReviseType.PercentBase: revise = maxSP * reviseValue; break; case ReviseType.PercentCurrent: revise = currentSP * reviseValue; break; case ReviseType.PercentUsed: revise = (maxSP - currentSP) * reviseValue; break; } switch (computeMode) { case ComputeMode.Add: currentSP += revise; break; case ComputeMode.Set: if (revise <= 0) { currentSP = Mathf.Min(currentSP, -revise); } else { currentSP = Mathf.Max(currentSP, revise); } break; } }