- S4-01 先确定 M1 需要的品质 / Tag
- S4-02 把品质计算整理成单一入口 规则边界 - S4-03 先固化 Tag 系统设计与首发范围
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
public static class InventoryRarityRuleService
|
||||
{
|
||||
public static RarityType NormalizeComponentRarity(RarityType rarity)
|
||||
{
|
||||
if (rarity < RarityType.White || rarity > RarityType.Red)
|
||||
{
|
||||
return RarityType.White;
|
||||
}
|
||||
|
||||
return rarity;
|
||||
}
|
||||
|
||||
public static RarityType ResolveTowerRarity(
|
||||
RarityType muzzleRarity,
|
||||
RarityType bearingRarity,
|
||||
RarityType baseRarity)
|
||||
{
|
||||
int normalizedMuzzle = (int)NormalizeComponentRarity(muzzleRarity);
|
||||
int normalizedBearing = (int)NormalizeComponentRarity(bearingRarity);
|
||||
int normalizedBase = (int)NormalizeComponentRarity(baseRarity);
|
||||
|
||||
float average = (normalizedMuzzle + normalizedBearing + normalizedBase) / 3f;
|
||||
int rounded = Mathf.RoundToInt(average);
|
||||
int clamped = Mathf.Clamp(rounded, (int)RarityType.White, (int)RarityType.Red);
|
||||
return (RarityType)clamped;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d65ff6ea2dc49be85529a7ca4c87fc8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user