引擎修改
This commit is contained in:
@@ -39,6 +39,8 @@ namespace AibisDream
|
||||
private bool _isTargetReached;
|
||||
private bool _isDiscReady;
|
||||
|
||||
public float initSpeed = 1;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Init();
|
||||
@@ -65,6 +67,10 @@ namespace AibisDream
|
||||
var panelShafts = _panel.GetComponentsInChildren<Shaft>();
|
||||
_shaftGraph = new ShaftGraph(shafts, panelShafts);
|
||||
|
||||
var engine = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
||||
_shaftGraph.StartRotate(initSpeed);
|
||||
engine.updateSpeedEvent.AddListener(_shaftGraph.Accelerate);
|
||||
|
||||
_panel.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ namespace AibisDream
|
||||
|
||||
[SerializeField] private Gear childGear;
|
||||
|
||||
// 初始角速度
|
||||
[SerializeField] private float initialSpeed;
|
||||
|
||||
// 目标角速度
|
||||
[SerializeField] private float targetSpeed;
|
||||
|
||||
@@ -70,8 +67,7 @@ namespace AibisDream
|
||||
|
||||
// 如果带齿轮,要根据齿轮类型生成
|
||||
childGear = InitGear(initRadius, initSprite, isInitGearBroken, isInitGearDisc);
|
||||
|
||||
speed = initialSpeed;
|
||||
|
||||
childGear.UpdateRotation(speed, _speedScale);
|
||||
}
|
||||
|
||||
@@ -274,7 +270,6 @@ namespace AibisDream
|
||||
isInitGearBroken = levelData.isGearBroken;
|
||||
isInitGearDisc = levelData.isDisc;
|
||||
discIdx = levelData.discIdx;
|
||||
initialSpeed = levelData.initialSpeed;
|
||||
targetSpeed = levelData.targetSpeed;
|
||||
initRadius = levelData.radius;
|
||||
}
|
||||
@@ -291,7 +286,6 @@ namespace AibisDream
|
||||
isGearBroken = isInitGearBroken,
|
||||
isDisc = isInitGearDisc,
|
||||
discIdx = discIdx,
|
||||
initialSpeed = initialSpeed,
|
||||
targetSpeed = targetSpeed,
|
||||
radius = initRadius
|
||||
};
|
||||
@@ -315,7 +309,6 @@ namespace AibisDream
|
||||
|
||||
// 关卡数据
|
||||
public ShaftType shaftType;
|
||||
public float initialSpeed;
|
||||
public float targetSpeed;
|
||||
public bool hasChildGear;
|
||||
public float radius;
|
||||
|
||||
@@ -43,6 +43,24 @@ namespace AibisDream
|
||||
UpdateSpeed();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化速度
|
||||
/// </summary>
|
||||
/// <param name="initSpeed">初始速度</param>
|
||||
public void StartRotate(float initSpeed)
|
||||
{
|
||||
_vertexArray[_rootIdx].speed = initSpeed;
|
||||
UpdateSpeed();
|
||||
}
|
||||
|
||||
public void Accelerate(float originSpeed, float speed)
|
||||
{
|
||||
foreach (var shaft in _vertexArray)
|
||||
{
|
||||
if (shaft.HasChildGear()) shaft.UpdateSpeedScale(speed);
|
||||
}
|
||||
}
|
||||
|
||||
private int FindDriverIdx()
|
||||
{
|
||||
for (int i = 0; i < _vertexSize; i++)
|
||||
@@ -261,17 +279,5 @@ namespace AibisDream
|
||||
|
||||
return isShaftAvailable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过引擎系统加速
|
||||
/// </summary>
|
||||
/// <param name="curSpeed">当前速度</param>
|
||||
private void Accelerate(float curSpeed)
|
||||
{
|
||||
foreach (var shaft in _vertexArray)
|
||||
{
|
||||
if (shaft.HasChildGear()) shaft.UpdateSpeedScale(1 + curSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user