Compare commits
No commits in common. "25ee0c522d8bda647f8bf8148d8cce254d06b59d" and "d78414e9236970de9eeefe309fb885a03e9b6fb4" have entirely different histories.
25ee0c522d
...
d78414e923
|
|
@ -67,7 +67,7 @@ TextureImporter:
|
|||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 64
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ public class Device_Base : PermanentTriggerBase
|
|||
/// trigger触发事件
|
||||
/// </summary>
|
||||
public Func<string, bool, int> triggerAction;
|
||||
/// <summary>
|
||||
/// 是否正在移动
|
||||
/// </summary>
|
||||
public bool isMoving;
|
||||
|
||||
private Vector3 head_LocalPos;
|
||||
private Vector3 head_LocalEulerAnglesl;
|
||||
|
|
|
|||
|
|
@ -184,13 +184,11 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
//拆下电能表
|
||||
if (!fix_screw_left.isInstall && !fix_screw_right.isInstall)
|
||||
{
|
||||
startAction?.Invoke();
|
||||
SiteManager.instance.measuringCabinet.meteringDevice = null;
|
||||
Debug.Log("电能表已拆除");
|
||||
transform.DOLocalMove(transform.localPosition - new Vector3(0, 0.2f, 0.2f), 2).OnComplete(() =>
|
||||
{
|
||||
CallScoreAction(false);
|
||||
endAction?.Invoke();
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
|
@ -205,7 +203,6 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
SiteManager.instance.measuringCabinet.meteringDevice = this;
|
||||
//默认是拆除的状态
|
||||
Init(false);
|
||||
startAction?.Invoke();
|
||||
transform.DOLocalMove(new Vector3(0.1469002f, -0.1793365f, 0.5191498f), 2).OnStart(() =>
|
||||
{
|
||||
transform.localEulerAngles = Vector3.zero;
|
||||
|
|
@ -214,7 +211,6 @@ public class Device_3Phase4WireMeter : Device_Base
|
|||
LiveSceneManager.Instance.currentTool = null;
|
||||
Debug.Log("电能表已安装");
|
||||
CallScoreAction(true);
|
||||
endAction?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,25 +31,22 @@ public class Device_Cover : Device_Base
|
|||
protected override void OnMDown()
|
||||
{
|
||||
base.OnMDown();
|
||||
if (!isMoving)
|
||||
if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0)
|
||||
{
|
||||
if ((triggerAction == null ? 0 : triggerAction.Invoke(triggerName, false)) == 0)
|
||||
{
|
||||
isCheckOK = true;
|
||||
isCheckOK = true;
|
||||
|
||||
if (!isOpen)
|
||||
if (!isOpen)
|
||||
{
|
||||
//螺丝都拧松才能拆盖子
|
||||
if (!cover_screw_Left.isInstall && !cover_screw_Right.isInstall)
|
||||
{
|
||||
//ÂÝË¿¶¼Å¡ËɲÅÄܲð¸Ç×Ó
|
||||
if (!cover_screw_Left.isInstall && !cover_screw_Right.isInstall)
|
||||
{
|
||||
Open();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
Open();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,21 +58,17 @@ public class Device_Cover : Device_Base
|
|||
//盖子螺丝不在动才能动盖子
|
||||
if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving)
|
||||
{
|
||||
isMoving = true;
|
||||
Debug.Log("打开盖子");
|
||||
startAction?.Invoke();
|
||||
isOpen = true;
|
||||
|
||||
Transform parent = cover_screw_Left.transform.parent;
|
||||
cover_screw_Left.transform.parent = transform;
|
||||
cover_screw_Right.transform.parent = transform;
|
||||
transform.DOLocalMove(new Vector3(transform.localPosition.x, -0.1388763f, -0.2485413f), 2).OnComplete(() =>
|
||||
{
|
||||
isOpen = true;
|
||||
cover_screw_Left.transform.parent = parent;
|
||||
cover_screw_Right.transform.parent = parent;
|
||||
isMoving = false;
|
||||
|
||||
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
endAction?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -88,21 +81,17 @@ public class Device_Cover : Device_Base
|
|||
//盖子螺丝不在动才能动盖子
|
||||
if (!cover_screw_Left.isMoving && !cover_screw_Right.isMoving)
|
||||
{
|
||||
isMoving=true;
|
||||
Debug.Log("盖上盖子");
|
||||
startAction?.Invoke();
|
||||
isOpen = false;
|
||||
|
||||
Transform parent = cover_screw_Left.transform.parent;
|
||||
cover_screw_Left.transform.parent = transform;
|
||||
cover_screw_Right.transform.parent = transform;
|
||||
transform.DOLocalMove(new Vector3(transform.localPosition.x, 0.01112366f, -0.09854126f), 2).OnComplete(() =>
|
||||
{
|
||||
isOpen = false;
|
||||
cover_screw_Left.transform.parent = parent;
|
||||
cover_screw_Right.transform.parent = parent;
|
||||
isMoving = false;
|
||||
|
||||
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
endAction?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ public class Device_NamePlate : Device_Base
|
|||
GameObject tip = Instantiate<GameObject>(checkUiPrefb, GameManager.UIMgr.canvas.transform);
|
||||
ProcessTipPanel processTipPanel = tip.GetComponent<ProcessTipPanel>();
|
||||
|
||||
startAction?.Invoke();
|
||||
//¿ªÊ¼×ß½ø¶È
|
||||
processTipPanel.StartProcess(result =>
|
||||
{
|
||||
|
|
@ -50,7 +49,6 @@ public class Device_NamePlate : Device_Base
|
|||
}
|
||||
int state = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
|
||||
CallScoreAction();
|
||||
endAction?.Invoke();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ public class Device_CabinetDoor : Device_Base
|
|||
public void Open()
|
||||
{
|
||||
Debug.Log("开门");
|
||||
startAction?.Invoke();
|
||||
//开锁
|
||||
transform.Find("计量柜锁2/计量柜锁3").DOLocalRotate(new Vector3(-45f, 0, 0), 1).OnComplete(() =>
|
||||
{
|
||||
|
|
@ -31,14 +30,12 @@ public class Device_CabinetDoor : Device_Base
|
|||
transform.DOLocalRotate(new Vector3(0, 0, 180), 3).OnComplete(() =>
|
||||
{
|
||||
isOpen = true;
|
||||
endAction?.Invoke();
|
||||
});
|
||||
});
|
||||
}
|
||||
public void Close()
|
||||
{
|
||||
Debug.Log("关门");
|
||||
startAction?.Invoke();
|
||||
//关门
|
||||
transform.DOLocalRotate(new Vector3(0, 0, 0), 3).OnComplete(() =>
|
||||
{
|
||||
|
|
@ -46,7 +43,6 @@ public class Device_CabinetDoor : Device_Base
|
|||
transform.Find("计量柜锁2/计量柜锁3").DOLocalRotate(new Vector3(0, 0, 0), 1).OnComplete(() =>
|
||||
{
|
||||
isOpen = false;
|
||||
endAction?.Invoke();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ public class Tool_Base : PermanentTriggerBase
|
|||
transform.localPosition = head_LocalPos;
|
||||
transform.localEulerAngles = head_LocalEulerAnglesl;
|
||||
isMoving = false;
|
||||
endAction?.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,24 +55,36 @@ public class Tool_Screw : Tool_Base
|
|||
/// <param name="screwdriver"></param>
|
||||
public void BeInstalled(Tool_Screwdriver screwdriver)
|
||||
{
|
||||
//动画
|
||||
transform.DOLocalMoveY(initPostionY, 1)
|
||||
.OnUpdate(() =>
|
||||
if (!isMoving && !screwdriver.isMoving)
|
||||
{
|
||||
isMoving = true;
|
||||
screwdriver.isMoving = true;
|
||||
Debug.Log("开始拧紧螺丝");
|
||||
//设置螺丝刀初始位置
|
||||
screwdriver.transform.parent = null;
|
||||
screwdriver.transform.DOLocalRotate(installPos.localEulerAngles, 0.5f);
|
||||
screwdriver.transform.DOMove(installPos.position, 1).OnComplete(() =>
|
||||
{
|
||||
transform.RotateAroundLocal(Vector3.up, 1);
|
||||
screwdriver.transform.position = installPos.position;
|
||||
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
||||
})
|
||||
.OnComplete(() =>
|
||||
{
|
||||
Debug.Log("螺丝已拧紧");
|
||||
isInstall = true;
|
||||
isMoving = false;
|
||||
screwdriver.isMoving = false;
|
||||
installAction?.Invoke(true);
|
||||
screwdriver.ReBackHead();
|
||||
CallScoreAction(true);
|
||||
//动画
|
||||
transform.DOLocalMoveY(initPostionY, 1)
|
||||
.OnUpdate(() =>
|
||||
{
|
||||
transform.RotateAroundLocal(Vector3.up, 1);
|
||||
screwdriver.transform.position = installPos.position;
|
||||
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
||||
})
|
||||
.OnComplete(() =>
|
||||
{
|
||||
Debug.Log("螺丝已拧紧");
|
||||
isInstall = true;
|
||||
isMoving = false;
|
||||
screwdriver.isMoving = false;
|
||||
installAction?.Invoke(true);
|
||||
screwdriver.ReBackHead();
|
||||
CallScoreAction(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -81,23 +93,35 @@ public class Tool_Screw : Tool_Base
|
|||
/// <param name="screwdriver"></param>
|
||||
public void BeUnInstalled(Tool_Screwdriver screwdriver)
|
||||
{
|
||||
//动画
|
||||
transform.DOLocalMoveY(initPostionY - 0.02f, 1)
|
||||
.OnUpdate(() =>
|
||||
if (!isMoving && !screwdriver.isMoving)
|
||||
{
|
||||
isMoving = true;
|
||||
screwdriver.isMoving = true;
|
||||
Debug.Log("开始卸螺丝");
|
||||
//设置螺丝刀初始位置
|
||||
screwdriver.transform.parent = null;
|
||||
screwdriver.transform.DOLocalRotate(installPos.localEulerAngles, 0.5f);
|
||||
screwdriver.transform.DOMove(installPos.position, 1).OnComplete(() =>
|
||||
{
|
||||
transform.RotateAroundLocal(Vector3.up, 1);
|
||||
screwdriver.transform.position = installPos.position;
|
||||
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
||||
})
|
||||
.OnComplete(() =>
|
||||
{
|
||||
Debug.Log("螺丝已拧松");
|
||||
isInstall = false;
|
||||
isMoving = false;
|
||||
screwdriver.isMoving = false;
|
||||
installAction?.Invoke(false);
|
||||
screwdriver.ReBackHead();
|
||||
CallScoreAction(false);
|
||||
//动画
|
||||
transform.DOLocalMoveY(initPostionY - 0.02f, 1)
|
||||
.OnUpdate(() =>
|
||||
{
|
||||
transform.RotateAroundLocal(Vector3.up, 1);
|
||||
screwdriver.transform.position = installPos.position;
|
||||
screwdriver.transform.RotateAroundLocal(Vector3.right, 10);
|
||||
})
|
||||
.OnComplete(() =>
|
||||
{
|
||||
Debug.Log("螺丝已拧松");
|
||||
isInstall = false;
|
||||
isMoving = false;
|
||||
screwdriver.isMoving = false;
|
||||
installAction?.Invoke(false);
|
||||
screwdriver.ReBackHead();
|
||||
CallScoreAction(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,19 +14,9 @@ public class Tool_Screwdriver : Tool_Base
|
|||
/// <param name="screw"></param>
|
||||
public void Install(Tool_Screw screw)
|
||||
{
|
||||
if (!screw.isInstall && !screw.isMoving && !isMoving)
|
||||
if (!screw.isInstall)
|
||||
{
|
||||
screw.isMoving = true;
|
||||
isMoving = true;
|
||||
Debug.Log("开始拧紧螺丝");
|
||||
startAction?.Invoke();
|
||||
//螺丝刀移到螺丝上
|
||||
transform.parent = null;
|
||||
transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f);
|
||||
transform.DOMove(screw.installPos.position, 1).OnComplete(() =>
|
||||
{
|
||||
screw.BeInstalled(this);
|
||||
});
|
||||
screw.BeInstalled(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -36,19 +26,9 @@ public class Tool_Screwdriver : Tool_Base
|
|||
/// <param name="screw"></param>
|
||||
public void UnInstall(Tool_Screw screw)
|
||||
{
|
||||
if (screw.isInstall && !screw.isMoving && !isMoving)
|
||||
if (screw.isInstall)
|
||||
{
|
||||
screw.isMoving = true;
|
||||
isMoving = true;
|
||||
Debug.Log("开始卸螺丝");
|
||||
startAction?.Invoke();
|
||||
//螺丝刀移到螺丝处
|
||||
transform.parent = null;
|
||||
transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f);
|
||||
transform.DOMove(screw.installPos.position, 1).OnComplete(() =>
|
||||
{
|
||||
screw.BeUnInstalled(this);
|
||||
});
|
||||
screw.BeUnInstalled(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ public class Tool_TestPen : Tool_Base
|
|||
if (tool_base.toolType == ToolType.螺丝)
|
||||
{
|
||||
var tmp = ((Tool_Screw)tool_base);
|
||||
base.startAction?.Invoke();
|
||||
//位置移动
|
||||
transform.parent = null;
|
||||
transform.DOLocalRotate(tmp.installPos.localEulerAngles, 0.5f);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ public class Tool_WireStripper : Tool_Base
|
|||
/// <param name="device_Seal"></param>
|
||||
public void CutOpen(Device_Seal device_Seal)
|
||||
{
|
||||
base.startAction?.Invoke();
|
||||
base.isMoving = true;
|
||||
isMoving = true;
|
||||
transform.parent = null;
|
||||
transform.DORotate(device_Seal.testPosAndRot.eulerAngles, 0.5f);
|
||||
transform.DOMove(device_Seal.testPosAndRot.position, 1).OnComplete(() =>
|
||||
|
|
|
|||
|
|
@ -18,14 +18,6 @@ public class PermanentTriggerBase : MonoBehaviour
|
|||
/// 打分事件
|
||||
/// </summary>
|
||||
private Action<string, object, int, int> scoreAction;
|
||||
/// <summary>
|
||||
/// 开始操作的回调(工具为从手里开始使用时调用,设备为开始操作时调用)
|
||||
/// </summary>
|
||||
protected Action startAction;
|
||||
/// <summary>
|
||||
/// 操作结束回调(工具为回到手中时调用,设备为操作结束时调用)
|
||||
/// </summary>
|
||||
protected Action endAction;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue