重构
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class CoolingMachineSystem : MonoBehaviour, ICoolingMachine
|
||||
{
|
||||
public bool isMachineEmpty;
|
||||
|
||||
public GameObject bottleSlot;
|
||||
public CoolingBottle bottle;
|
||||
public GameObject pumpHead;
|
||||
public GameObject lockSwitch;
|
||||
public GameObject pumpButton;
|
||||
|
||||
#region 对外暴露
|
||||
|
||||
public void LinkRobot()
|
||||
{
|
||||
// TODO 这里是应该ta来控制吗?存疑
|
||||
isMachineEmpty = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 泵出冷却液
|
||||
/// </summary>
|
||||
public void PumpCooling()
|
||||
{
|
||||
// 泵头下降
|
||||
|
||||
// 液面上升
|
||||
|
||||
// 完成后液体满了
|
||||
isMachineEmpty = true;
|
||||
}
|
||||
|
||||
public void UnlockBottle()
|
||||
{
|
||||
// 卡扣上移
|
||||
|
||||
// 瓶子外旋
|
||||
|
||||
// 机器空置
|
||||
isMachineEmpty = false;
|
||||
}
|
||||
|
||||
public void MoveOutBottle()
|
||||
{
|
||||
// 瓶子置空
|
||||
bottle.transform.parent = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void InsertBottle(CoolingBottle newBottle)
|
||||
{
|
||||
// 改变瓶子归属
|
||||
newBottle.transform.parent = bottleSlot.transform;
|
||||
bottle = newBottle;
|
||||
|
||||
}
|
||||
|
||||
public void LockBottle()
|
||||
{
|
||||
// 插槽回旋
|
||||
|
||||
// 卡扣下降
|
||||
|
||||
// 同步液体状态
|
||||
isMachineEmpty = bottle.isEmpty;
|
||||
|
||||
// TODO 同步泵头状态
|
||||
|
||||
}
|
||||
|
||||
public void InjectCool()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void UnlinkRobot()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 冷却系统有什么样的行为?
|
||||
/// </summary>
|
||||
public interface ICoolingMachine
|
||||
{
|
||||
void LinkRobot();
|
||||
void PumpCooling();
|
||||
void UnlockBottle();
|
||||
void MoveOutBottle();
|
||||
void InsertBottle(CoolingBottle bottle);
|
||||
void LockBottle();
|
||||
void InjectCool();
|
||||
void UnlinkRobot();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user