feat(fix-system): 添加维修模块运行状态表现
This commit is contained in:
@@ -36,6 +36,13 @@ namespace AibisDream.FixSystem
|
||||
[SerializeField]
|
||||
private SpriteRenderer targetSpriteRenderer; // 目标的 SpriteRenderer
|
||||
|
||||
[Header("模块运行状态")]
|
||||
[SerializeField] private ModuleConditionVisual conditionVisual;
|
||||
[SerializeField] private ModuleCondition condition = ModuleCondition.Normal;
|
||||
|
||||
public ModuleCondition Condition => condition;
|
||||
public bool SupportsConditionVisual => conditionVisual != null && conditionVisual.IsConfigured;
|
||||
|
||||
private SpriteRenderer _cutSpriteRenderer;
|
||||
private SpriteRenderer _cutTextRenderer; // 添加cutText的SpriteRenderer引用
|
||||
|
||||
@@ -60,6 +67,7 @@ namespace AibisDream.FixSystem
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(LoadMaterial());
|
||||
conditionVisual?.ApplyCondition(condition);
|
||||
}
|
||||
|
||||
protected virtual void InitReference()
|
||||
@@ -192,6 +200,26 @@ namespace AibisDream.FixSystem
|
||||
|
||||
#endregion
|
||||
|
||||
#region 模块运行状态
|
||||
|
||||
/// <summary>
|
||||
/// 设置模块表现状态。状态只影响独立文字与火花,不影响 Module Pic、插线或切割逻辑。
|
||||
/// </summary>
|
||||
public bool SetCondition(ModuleCondition newCondition)
|
||||
{
|
||||
if (conditionVisual == null)
|
||||
{
|
||||
Debug.LogWarning($"[BodyModule] Module {data.moduleName} has no ModuleConditionVisual configured.", this);
|
||||
return false;
|
||||
}
|
||||
|
||||
condition = newCondition;
|
||||
conditionVisual.ApplyCondition(newCondition);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 切割相关
|
||||
|
||||
public void OnCuttingDown()
|
||||
@@ -295,4 +323,11 @@ namespace AibisDream.FixSystem
|
||||
// 只读
|
||||
[JsonIgnore] public string PlugInNodeName => string.Format(PlugInNodeTemplate, moduleName);
|
||||
}
|
||||
}
|
||||
|
||||
public enum ModuleCondition
|
||||
{
|
||||
Normal,
|
||||
Damaged,
|
||||
PoweredOff
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user