Day1Day2重构基本完成

This commit is contained in:
2024-12-23 23:47:26 +08:00
parent 4e08fda3e6
commit 6341fbe46f
30 changed files with 2658 additions and 367 deletions
@@ -17,6 +17,7 @@ namespace AibisDream.FixSystem
public GameObject bodyModulePrefab;
[HideInInspector]public Transform bodyModuleGroup;
[HideInInspector]public OscilloscopeSystem oscilloscopeSystem;
[HideInInspector]public HeatMapController heatMapController;
#endregion
@@ -38,6 +39,16 @@ namespace AibisDream.FixSystem
#region
public bool inHotErr;
private int heatValue;
public int HeatValue
{
get => heatValue;
set
{
heatValue = value;
inHotErr = heatValue > 0;
}
}
[HideInInspector]public BodyModule curBodyModule;
#endregion
@@ -56,7 +67,7 @@ namespace AibisDream.FixSystem
CableSystem = transform.Find("Cable System").GetComponent<CableSystem>();
bodyModuleGroup = transform.Find("Body Module Group");
oscilloscopeSystem = transform.Find("Oscilloscope System").GetComponent<OscilloscopeSystem>();
heatMapController=transform.Find("HeatMapController").GetComponent<HeatMapController>();
FixSystemCenter.SystemDic.Register(this);
}
@@ -95,6 +106,15 @@ namespace AibisDream.FixSystem
return false;
}
}
/// <summary>
/// 寻找指定名称的BodyModule
/// </summary>
/// <param name="modulename">模块名称</param>
/// <returns>对应名称的BodyModule</returns>
public BodyModule FindBodyModuleByName(string modulename)
{
return BodyModules?.FirstOrDefault(module => module.data.moduleName == modulename);
}
/// <summary>
/// 深入检查
@@ -106,16 +126,50 @@ namespace AibisDream.FixSystem
CableSystem.curBodyModule.DeepIn();
}
}
/// <summary>
/// 设置死循环状态
/// </summary>
public void SetModuleState_CantStopRunning(string moduleName,bool state)
{
BodyModule result = FindBodyModuleByName(moduleName);
if (result != null)
{
Debug.Log("Found module: " + moduleName);
result.data.cantStopRunning=state;
}
else
{
Debug.Log("Module not found.");
}
}
/// <summary>
/// 设置发热
/// </summary>
public void SetHeat(int targetHeatValue)
{
HeatValue=targetHeatValue;
heatMapController.SetTemptureDirect(HeatValue);
}
public void ShowHeatMap()
{
heatMapController.ShowHeatMap();
ResetPlug();
}
public void HideHeatMap()
{
heatMapController.HideHeatMap();
}
/// <summary>
/// 冷却后处理
/// </summary>
public void OnCooling()
{
if (!inHotErr) return;
if (!inHotErr) return;
// 系统冷却
inHotErr = false;
heatValue = 0;
curBodyModule?.ShowWave();
}
/// <summary>