齿轮控制
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
@@ -39,6 +40,11 @@ namespace AibisDream
|
||||
private bool _isTargetReached;
|
||||
private bool _isDiscReady;
|
||||
public bool isAvailable;
|
||||
private bool _isInteractive;
|
||||
|
||||
public bool IsGearActive => isAvailable && _isInteractive;
|
||||
|
||||
private IUnRegister[] _evtUnRegisters;
|
||||
|
||||
public float initSpeed = 1;
|
||||
|
||||
@@ -62,6 +68,21 @@ namespace AibisDream
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Gear, virtualCam);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
var unRegister1 = EnumEventSystem.Global.Register(InteractionEventEnum.Start, () => _isInteractive = true);
|
||||
var unRegister2 = EnumEventSystem.Global.Register(InteractionEventEnum.End, () => _isInteractive = false);
|
||||
_evtUnRegisters = new[] { unRegister1, unRegister2 };
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
foreach (var evtUnRegister in _evtUnRegisters)
|
||||
{
|
||||
evtUnRegister.UnRegister();
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InitShaftGraph();
|
||||
@@ -149,6 +170,7 @@ namespace AibisDream
|
||||
{
|
||||
StorageSystem.Instance?.SetValue("$allNewGear", true);
|
||||
}
|
||||
|
||||
DialogController.Instance?.StartDialogNode("AllGearsRunning");
|
||||
}
|
||||
}
|
||||
@@ -352,14 +374,14 @@ namespace AibisDream
|
||||
Debug.Log("没有找到配置项");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 删除面板上的齿轮
|
||||
var panelShafts = transform.Find("Empty Shafts Panel").GetComponentsInChildren<Shaft>();
|
||||
foreach (var shaftItem in panelShafts)
|
||||
{
|
||||
Destroy(shaftItem);
|
||||
}
|
||||
|
||||
|
||||
// 读取数据
|
||||
var panelShaftRoot = transform.Find("Empty Shafts Panel");
|
||||
var newPanelShafts = new Shaft[data.panelShaftArray.Length];
|
||||
@@ -369,7 +391,7 @@ namespace AibisDream
|
||||
newShaft.Load(data.panelShaftArray[i]);
|
||||
newPanelShafts[i] = newShaft;
|
||||
}
|
||||
|
||||
|
||||
_shaftGraph.UpdatePanel(newPanelShafts);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user