问题修复
This commit is contained in:
@@ -23,7 +23,7 @@ namespace AibisDream
|
||||
private void OnSpeedChange(float originSpeed, float speedScale)
|
||||
{
|
||||
_material.SetFloat(VibrateFade, originSpeed);
|
||||
progress.CurrentValue = Mathf.RoundToInt(originSpeed * 16000 + 1000);
|
||||
progress.CurrentValue = Mathf.RoundToInt(originSpeed * 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,6 +154,10 @@ namespace AibisDream
|
||||
|
||||
if (_shaftGraph.AllRunning())
|
||||
{
|
||||
if (_shaftGraph.AllNewGear())
|
||||
{
|
||||
DialogController.Instance?.SetVariable("$allNewGear", true);
|
||||
}
|
||||
DialogController.Instance?.StartDialogNode("AllGearsRunning");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace AibisDream
|
||||
[SerializeField] private Sprite initSprite;
|
||||
[SerializeField] private int discIdx;
|
||||
|
||||
[SerializeField] private Gear childGear;
|
||||
[SerializeField] public Gear childGear;
|
||||
|
||||
// 目标角速度
|
||||
[SerializeField] private float targetSpeed;
|
||||
|
||||
@@ -8,13 +8,18 @@ namespace AibisDream
|
||||
{
|
||||
// 顶点数量
|
||||
private readonly int _vertexSize;
|
||||
|
||||
// 顶点Map
|
||||
private readonly Shaft[] _vertexArray;
|
||||
|
||||
private Shaft[] _panelShafts;
|
||||
|
||||
// 邻接表
|
||||
private float[,] _edgeTable;
|
||||
|
||||
// 遍历记录
|
||||
private readonly bool[] _vertexRecordArray;
|
||||
|
||||
// 动力轴序号
|
||||
private readonly int _rootIdx;
|
||||
|
||||
@@ -29,6 +34,7 @@ namespace AibisDream
|
||||
{
|
||||
shaft.InitShaft();
|
||||
}
|
||||
|
||||
foreach (var shaft in _panelShafts)
|
||||
{
|
||||
shaft.InitShaft();
|
||||
@@ -36,7 +42,7 @@ namespace AibisDream
|
||||
|
||||
// 寻找唯一的驱动轴序号
|
||||
_rootIdx = FindDriverIdx();
|
||||
|
||||
|
||||
// 生成边邻接表
|
||||
GeneEdgeTable();
|
||||
|
||||
@@ -62,6 +68,16 @@ namespace AibisDream
|
||||
return _vertexArray.All(shaft => Mathf.Abs(shaft.speed) > 0.01f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否所有齿轮都是新的
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool AllNewGear()
|
||||
{
|
||||
return _vertexArray.Where(shaft => shaft.shaftType != ShaftType.Driver).All(shaft =>
|
||||
shaft.childGear != null && shaft.childGear.gearProp == "NewGear");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化速度
|
||||
/// </summary>
|
||||
@@ -71,7 +87,7 @@ namespace AibisDream
|
||||
_vertexArray[_rootIdx].speed = initSpeed;
|
||||
UpdateSpeed();
|
||||
}
|
||||
|
||||
|
||||
public void Accelerate(float originSpeed, float speed)
|
||||
{
|
||||
foreach (var shaft in _vertexArray)
|
||||
@@ -128,7 +144,7 @@ namespace AibisDream
|
||||
// 找到对应idx
|
||||
int idx = TranInstanceIDToIdx(instanceID);
|
||||
if (idx == -1) return;
|
||||
|
||||
|
||||
// 更新该节点对应的邻接表
|
||||
for (int i = 0; i < _vertexSize; i++)
|
||||
{
|
||||
@@ -150,7 +166,7 @@ namespace AibisDream
|
||||
_edgeTable[i, idx] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UpdateSpeed();
|
||||
}
|
||||
|
||||
@@ -181,7 +197,7 @@ namespace AibisDream
|
||||
_vertexRecordArray[_rootIdx] = true;
|
||||
UpdateShaftSpeedByIdx(_rootIdx);
|
||||
UpdateUnreachableShafts();
|
||||
|
||||
|
||||
// 更新完速度后统一更新动画
|
||||
foreach (var shaft in _vertexArray)
|
||||
{
|
||||
@@ -218,7 +234,7 @@ namespace AibisDream
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UpdateUnreachableShafts()
|
||||
{
|
||||
// 从Driver开始相连的齿轮全部更新后,剩下的齿轮置空
|
||||
|
||||
Reference in New Issue
Block a user