[Add] Dice & Refactor private names
This commit is contained in:
@@ -19,7 +19,7 @@ namespace YachtDice.Dice
|
||||
|
||||
[SerializeField] private List<Entry> entries = new();
|
||||
|
||||
private HashSet<Entry> entrySet;
|
||||
private HashSet<Entry> _entrySet;
|
||||
|
||||
private void Awake() => RebuildSet();
|
||||
private void OnValidate() => RebuildSet();
|
||||
@@ -36,9 +36,9 @@ namespace YachtDice.Dice
|
||||
|
||||
private void RebuildSet()
|
||||
{
|
||||
entrySet = new HashSet<Entry>();
|
||||
_entrySet = new HashSet<Entry>();
|
||||
if (entries == null) return;
|
||||
for (int i = 0; i < entries.Count; i++) entrySet.Add(entries[i]);
|
||||
for (int i = 0; i < entries.Count; i++) _entrySet.Add(entries[i]);
|
||||
}
|
||||
|
||||
public bool TryGetTopValue(out int value) => TryGetExtremeValue(isTop: true, out value);
|
||||
@@ -62,14 +62,14 @@ namespace YachtDice.Dice
|
||||
{
|
||||
value = default;
|
||||
|
||||
if (entrySet == null || entrySet.Count == 0)
|
||||
if (_entrySet == null || _entrySet.Count == 0)
|
||||
return false;
|
||||
|
||||
bool found = false;
|
||||
float bestY = isTop ? float.NegativeInfinity : float.PositiveInfinity;
|
||||
int best = default;
|
||||
|
||||
foreach (var e in entrySet)
|
||||
foreach (var e in _entrySet)
|
||||
{
|
||||
var p = e.Point;
|
||||
if (!p) continue;
|
||||
@@ -91,14 +91,14 @@ namespace YachtDice.Dice
|
||||
|
||||
private Entry GetExtremeEntryByWorldY(bool isTop)
|
||||
{
|
||||
if (entrySet == null || entrySet.Count == 0)
|
||||
if (_entrySet == null || _entrySet.Count == 0)
|
||||
throw new InvalidOperationException("Dice: коллекция пуста.");
|
||||
|
||||
bool found = false;
|
||||
float bestY = isTop ? float.NegativeInfinity : float.PositiveInfinity;
|
||||
Entry best = default;
|
||||
|
||||
foreach (var e in entrySet)
|
||||
foreach (var e in _entrySet)
|
||||
{
|
||||
var p = e.Point;
|
||||
if (!p) continue;
|
||||
|
||||
Reference in New Issue
Block a user