1.修复Updatement中遗漏的bug2.对生成进行了一定的优化

This commit is contained in:
2025-12-03 16:58:56 +08:00
parent c80d5140bc
commit 174a8c6df2
5 changed files with 56 additions and 31 deletions

View File

@@ -38,7 +38,7 @@ namespace Demo.Game
}
public int Content = 0;
private List<UpdatementEntry> Entries = new();
private readonly List<UpdatementEntry> Entries = new();
public UpdatementCompiledEntries CompiledEntries;
protected abstract void UpdateData(DataType data);
protected abstract DataType Lerp(DataType begin, DataType end, float t);
@@ -77,7 +77,6 @@ namespace Demo.Game
index++;
}
Entries.Clear();
Entries = null;
}
private void UpdateEntry(int start, float percent)
@@ -101,7 +100,9 @@ namespace Demo.Game
public override void ResetEnterGameStatus()
{
base.ResetEnterGameStatus();
base.ResetEnterGameStatus();
if (CompiledEntries.Count <= 1)
return;
UpdateEntry(0, 0);
}
@@ -118,6 +119,8 @@ namespace Demo.Game
float GetPercentValue()
{
if (Content + 1 == CompiledEntries.Count)
return 1;
return (currentTime - CompiledEntries.TimePoints[Content]) / (CompiledEntries.TimePoints[Content + 1] - CompiledEntries.TimePoints[Content]);
}
@@ -137,14 +140,11 @@ namespace Demo.Game
default:
if (CompiledEntries.TimePoints[0] > currentTime)
return;
if (Content + 1 >= CompiledEntries.Count)
return;
if (CompiledEntries.TimePoints[Content + 1] < currentTime)
if (Content + 1 < CompiledEntries.Count && CompiledEntries.TimePoints[Content + 1] < currentTime)
Content++;
if (Content + 1 >= CompiledEntries.Count)
UpdateEntry(Content, 1);
else
UpdateEntry(Content, GetPercentValue());
if (Content + 1 > CompiledEntries.Count)
return;
UpdateEntry(Content, GetPercentValue());
break;
}
}