缺一些东西,但是基本通了
缺task UF内部表现不对 擦除记忆不是手动的(或许可接受) 工具和鼠标相关的屏蔽
This commit is contained in:
@@ -13,7 +13,9 @@ public class Module : MonoBehaviour, IPointerClickHandler
|
||||
public float repairCanvasScale = 1.5f; // 维修模式下的面板缩放比例
|
||||
public float animationDuration = 0.5f; // 动画持续时间
|
||||
|
||||
public bool isallowedRepair = false; // 动画持续时间
|
||||
public bool isallowedRepair = false; // 动画持续时间
|
||||
|
||||
public bool isalloweInstall = false; // 动画持续时间
|
||||
|
||||
public GameObject screwsContainer; // 螺丝的父对象
|
||||
public RectTransform targetArea; // 拖拽的目标区域,用于判定维修完成
|
||||
@@ -23,27 +25,86 @@ public class Module : MonoBehaviour, IPointerClickHandler
|
||||
private Vector3 initialPosition;
|
||||
|
||||
private Plug plug;
|
||||
|
||||
|
||||
public bool isRepiarFinished=false;
|
||||
|
||||
public GameObject ObejctToInstall;
|
||||
public bool isInstall=false;
|
||||
|
||||
public Socket socketToEnable;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if(ObejctToInstall!=null)
|
||||
{
|
||||
if(isInstall)
|
||||
{
|
||||
ObejctToInstall.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ObejctToInstall.SetActive(false);
|
||||
}
|
||||
}
|
||||
if(isRepiarFinished)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
plug=FindObjectOfType<Plug>();
|
||||
initialPosition = transform.position;
|
||||
originalCanvasPosition = faceCanvas.position;
|
||||
//socketToEnable.raycastTarget=false;
|
||||
socketToEnable.IsAvailable=false;
|
||||
foreach (Transform screw in screwsContainer.transform)
|
||||
if(faceCanvas!=null)
|
||||
{
|
||||
originalCanvasPosition = faceCanvas.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
originalCanvasPosition=Vector3.zero;
|
||||
}
|
||||
|
||||
//socketToEnable.raycastTarget=false;
|
||||
if(socketToEnable!=null)
|
||||
{
|
||||
socketToEnable.IsAvailable=false;
|
||||
}
|
||||
if(screwsContainer!=null)
|
||||
{
|
||||
foreach (Transform screw in screwsContainer.transform)
|
||||
{
|
||||
screw.GetComponent<Screw>().enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void SetReapirState(bool state)
|
||||
{
|
||||
isRepiarFinished=state;
|
||||
if(isRepiarFinished)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
public void SetInstallState(bool state)
|
||||
{
|
||||
isInstall=state;
|
||||
if(isInstall)
|
||||
{
|
||||
ObejctToInstall.SetActive(true);
|
||||
isalloweInstall=false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ObejctToInstall.SetActive(false);
|
||||
}
|
||||
}
|
||||
// public void StartRepairIfToolIsScrewdriver(Tool tool)
|
||||
// {
|
||||
// EnterRepairMode();
|
||||
// }
|
||||
|
||||
|
||||
public void RemoveAllPlugsFromSockets()
|
||||
{
|
||||
Socket[] sockets = FindObjectsOfType<Socket>(); // 找到场景中的所有Socket组件
|
||||
@@ -95,7 +156,13 @@ public class Module : MonoBehaviour, IPointerClickHandler
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
public void Install()
|
||||
{
|
||||
Debug.Log(gameObject.name+"InStalled");
|
||||
isInstall=true;
|
||||
ObejctToInstall.SetActive(true);
|
||||
DialogController.Instance.StartDialogNode("FinishInstall");
|
||||
}
|
||||
public void EnableScrewsInteraction(bool isEnabled)
|
||||
{
|
||||
foreach (Transform screw in screwsContainer.transform)
|
||||
@@ -138,8 +205,9 @@ public class Module : MonoBehaviour, IPointerClickHandler
|
||||
screw.GetComponent<Screw>().enabled = false;
|
||||
}
|
||||
}
|
||||
Destroy(gameObject);
|
||||
CompleteRepair();
|
||||
Destroy(gameObject);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,6 +217,7 @@ public class Module : MonoBehaviour, IPointerClickHandler
|
||||
if (ToolManager.Instance.HasTool)
|
||||
{
|
||||
ToolManager.Instance.TryStartRepairMode(this);
|
||||
ToolManager.Instance.TryInstall(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user