现场功能

This commit is contained in:
陈向学 2024-08-20 18:37:07 +08:00
parent aea67c6e65
commit 92c9ff8cba
38 changed files with 1658 additions and 75 deletions

View File

@ -9,15 +9,18 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: "\u73BB\u7483"
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords: []
m_ValidKeywords:
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
RenderType: Transparent
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@ -88,7 +91,7 @@ Material:
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlend: 10
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
@ -101,10 +104,10 @@ Material:
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _SrcBlend: 5
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 0, g: 0, b: 0, a: 0.47215682}
- _Color: {r: 0, g: 0, b: 0, a: 0.47215682}

View File

@ -9,6 +9,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1965530637903639590}
- component: {fileID: 1979776030034460225}
- component: {fileID: 2925187013327622802}
m_Layer: 0
m_Name: "\u7EA2\u7B14"
m_TagString: Untagged
@ -32,6 +34,32 @@ Transform:
m_Father: {fileID: 5376839146013080726}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1979776030034460225
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2017067868099458191}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 52d1e3794f9e3724ab7d370707c165e9, type: 3}
m_Name:
m_EditorClassIdentifier:
id: "\u7EA2"
--- !u!65 &2925187013327622802
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2017067868099458191}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.012164328, y: 0.17317626, z: 0.011568989}
m_Center: {x: -0.0000000093132275, y: -0.075, z: 0.00000000651926}
--- !u!1 &3442245682270072348
GameObject:
m_ObjectHideFlags: 0
@ -319,6 +347,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 3466125173440610008}
- component: {fileID: 8389596032923302982}
- component: {fileID: 6526392614341423659}
m_Layer: 0
m_Name: "\u9ED1\u7B14"
m_TagString: Untagged
@ -342,6 +372,32 @@ Transform:
m_Father: {fileID: 5376839146013080726}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &8389596032923302982
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5597706746217307991}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 52d1e3794f9e3724ab7d370707c165e9, type: 3}
m_Name:
m_EditorClassIdentifier:
id: "\u9ED1"
--- !u!65 &6526392614341423659
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5597706746217307991}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.012164328, y: 0.17317626, z: 0.011568989}
m_Center: {x: -0.0000000093132275, y: -0.075, z: 0.00000000651926}
--- !u!1 &5681162065009577494
GameObject:
m_ObjectHideFlags: 0

View File

@ -332,6 +332,14 @@ PrefabInstance:
propertyPath: m_AABB.m_Extent.z
value: 7.0822697
objectReference: {fileID: 0}
- target: {fileID: -3887185075125053422, guid: 81f7b3028e3d6dc41bbbfc890e800692, type: 3}
propertyPath: m_BlendShapeWeights.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: -3887185075125053422, guid: 81f7b3028e3d6dc41bbbfc890e800692, type: 3}
propertyPath: m_BlendShapeWeights.Array.data[0]
value: 0
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 81f7b3028e3d6dc41bbbfc890e800692, type: 3}
propertyPath: m_Name
value: "\u5265\u7EBF\u94B3 (1)"

View File

@ -504,6 +504,7 @@ MonoBehaviour:
triggerID: 0
toolName:
toolOrDeviceOrMaterial: 0
selfObj: {fileID: 0}
_highlight: {fileID: 0}
--- !u!65 &3014182739139812810
BoxCollider:

View File

@ -345,6 +345,7 @@ GameObject:
m_Component:
- component: {fileID: 254869080}
- component: {fileID: 254869081}
- component: {fileID: 254869082}
m_Layer: 0
m_Name: 3001
m_TagString: Untagged
@ -385,6 +386,18 @@ MonoBehaviour:
schemeId: 0
subProcessId: 0
stepStateBases: []
--- !u!114 &254869082
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 254869079}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: efc96f6a32601eb468d03debfd8d9661, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &291527140
GameObject:
m_ObjectHideFlags: 0
@ -639,6 +652,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 552229449}
- component: {fileID: 552229450}
m_Layer: 0
m_Name: 1002
m_TagString: Untagged
@ -679,6 +693,18 @@ Transform:
m_Father: {fileID: 559582437}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &552229450
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 552229448}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 00415bfa520d2dd43b89c50a93350199, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &559582436
GameObject:
m_ObjectHideFlags: 0
@ -1667,6 +1693,7 @@ GameObject:
m_Component:
- component: {fileID: 1782595005}
- component: {fileID: 1782595004}
- component: {fileID: 1782595006}
m_Layer: 0
m_Name: "\u6B65\u9AA4\u72B6\u6001"
m_TagString: Untagged
@ -1702,6 +1729,18 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1782595006
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1782595003}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 728973cb69f5b2d4b9a1ef0a634de34b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2058314690
GameObject:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -11,4 +11,17 @@ public class Device_Seal : Device_Base
/// 是否被剪开
/// </summary>
public bool isCut;
/// <summary>
/// 被剪的位置
/// </summary>
public Transform testPosAndRot;
/// <summary>
/// 剪开封印
/// </summary>
public void Cut()
{
isCut = true;
gameObject.SetActive(false);
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f3fccb608fecd9e4a96ce0cfec08553f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,9 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
/// <summary>
/// 万用表挡位
/// </summary>
public class Multimeter_dangwei : MonoBehaviour, IPointerClickHandler
{
public Tool_Multimeter tool_Multimeter;

View File

@ -0,0 +1,74 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.EventSystems;
/// <summary>
/// 万用表笔
/// </summary>
public class Multimeter_pen : MonoBehaviour, IPointerClickHandler
{
//红或黑
public string id;
/// <summary>
/// 是否已选择
/// </summary>
private bool isChose;
public void OnPointerClick(PointerEventData eventData)
{
if(eventData.button== PointerEventData.InputButton.Left)
{
Debug.Log("选中"+ id+"笔");
//选中
isChose = true;
}
else if(eventData.button == PointerEventData.InputButton.Right)
{
Debug.Log("放开" + id + "笔");
//取消选中
isChose = false;
//回到初始位置
transform.localPosition = (id=="红"? new Vector3(-0.06210404f, 0.009172082f, -0.09704163f) :new Vector3(-0.08662688f, 0.009172082f, -0.09702184f));
}
}
/// <summary>
/// 执行验电操作
/// </summary>
/// <param name="tool_base">被验电设备</param>
public void Test(Tool_Base tool_base)
{
if (tool_base.toolType == ToolType.)
{
var tmp = ((Tool_Screw)tool_base);
//位置移动
transform.position = tmp.installPos.position;
transform.eulerAngles = tmp.installPos.eulerAngles;
Debug.Log("万能表笔验证螺丝");
}
}
private void Update()
{
if (isChose)
{
transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if(Input.GetMouseButtonDown(0))
{
//点击螺丝验电
Ray tmpray=Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(tmpray,out RaycastHit hit))
{
Tool_Screw screw= hit.transform.GetComponent<Tool_Screw>();
if(screw!=null)
{
Test(screw);
}
}
}
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ad21af12e5592364998f119df90e1a2e
guid: 52d1e3794f9e3724ab7d370707c165e9
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,59 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine;
/// <summary>
/// 接线盖子
/// </summary>
public class Device_Cover : Device_Base
{
/// <summary>
/// 盖子是否已打开
/// </summary>
public bool isOpen;
/// <summary>
/// 是否检查接线完好
/// </summary>
public bool isCheckOK;
private void OnMouseDown()
{
Debug.Log("接线完好");
isCheckOK = true;
if(!isOpen)
{
Device_DirectAccessElectricEnergyMeteringDevice deemd= transform.parent.GetComponent<Device_DirectAccessElectricEnergyMeteringDevice>();
if (!deemd.cover_screw_Left.isInstall && !deemd.cover_screw_Right.isInstall)
{
Open();
}
}
else if(isOpen)
{
Close();
}
}
/// <summary>
/// 打开盖子
/// </summary>
public void Open()
{
Debug.Log("打开盖子");
isOpen = true;
transform.DOLocalMoveZ(transform.localPosition.z - 0.15f, 2);
}
/// <summary>
/// 盖上盖子
/// </summary>
public void Close()
{
Debug.Log("盖上盖子");
isOpen = false;
transform.DOLocalMoveZ(transform.localPosition.z + 0.15f, 2);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c33992bdd7946a45a5c38ce1a776e9b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,18 +7,26 @@ using UnityEngine;
/// </summary>
public class Device_DirectAccessElectricEnergyMeteringDevice : Device_Base
{
public static Device_DirectAccessElectricEnergyMeteringDevice instance;
/// <summary>
/// 铭牌
/// </summary>
public Device_NamePlate namePlate;
/// <summary>
/// 合格标志
/// ½ÓÏ߸Ç×Ó
/// </summary>
public Device_MarkOfConformity conformity;
/// <summary>
/// 电能表盖子固定螺丝
/// </summary>
public List<Tool_Screw> cover_screws;
public Device_Cover cover;
[Tooltip("×ó¸Ç×ÓÂÝË¿")]
public Tool_Screw cover_screw_Left;
[Tooltip("ÓÒ¸Ç×ÓÂÝË¿")]
public Tool_Screw cover_screw_Right;
[Tooltip("×ó¸Ç×Ó·âÓ¡")]
public Device_Seal cover_seal_Left;
[Tooltip("ÓÒ¸Ç×Ó·âÓ¡")]
public Device_Seal cover_seal_Right;
/// <summary>
/// 电能表接线螺丝
/// </summary>
@ -31,5 +39,10 @@ public class Device_DirectAccessElectricEnergyMeteringDevice : Device_Base
/// 电能表固定螺丝
/// </summary>
public List<Tool_Screw> fix_screws;
private void Awake()
{
instance = this;
}
}

View File

@ -1,10 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 直接接入式电能计量装置_合格标志
/// </summary>
public class Device_MarkOfConformity : Device_Base
{
}

View File

@ -10,34 +10,40 @@ public class Device_NamePlate : Device_Base
/// <summary>
/// 是否检查
/// </summary>
public bool isCheck;
public bool isChecked;
/// <summary>
/// 核对和抄录UI
/// </summary>
public GameObject checkUiPrefb;
public ProcessTipPanel processTipPanel;
private GameObject checkUiPrefb;
private ProcessTipPanel processTipPanel;
/// <summary>
/// ºË¶ÔºÍ¼Ç¼
/// </summary>
public void Check()
{
if(checkUiPrefb==null)
{
checkUiPrefb = Resources.Load<GameObject>("UI/UI_Tip/ProcessTipPanel");
}
if(processTipPanel==null)
{
GameObject tip = Instantiate<GameObject>(checkUiPrefb, UIManager.Instance.canvas.transform);
processTipPanel = tip.GetComponent<ProcessTipPanel>();
}
}
private void OnMouseDown()
{
processTipPanel.SetProcess(true);
if (!isChecked)
{
//核对和记录
if (checkUiPrefb == null)
{
checkUiPrefb = Resources.Load<GameObject>("UI/UI_Tip/ProcessTipPanel");
}
if (processTipPanel == null)
{
GameObject tip = Instantiate<GameObject>(checkUiPrefb, UIManager.Instance.canvas.transform);
processTipPanel = tip.GetComponent<ProcessTipPanel>();
}
//开始走进度
processTipPanel.StartProcess(result =>
{
if(result)
{
Debug.Log("核查完成");
isChecked = true;
}
});
}
}
}

View File

@ -1,3 +1,4 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -11,6 +12,42 @@ public class Device_CabinetDoor : Device_Base
/// ÑéµçλÖÃ
/// </summary>
public Transform testPosAndRot;
/// <summary>
/// ·âÓ¡
/// </summary>
public Device_Seal seal;
public bool isOpen;
public void Open()
{
Debug.Log("¿ªÃÅ");
transform.DOLocalRotate(new Vector3(0,0,180), 3).OnComplete(() =>
{
isOpen = true;
});
}
public void Close()
{
Debug.Log("¹ØÃÅ");
transform.DOLocalRotate(new Vector3(0,0,0), 3).OnComplete(() =>
{
isOpen = false;
});
}
private void OnMouseDown()
{
if(seal.isCut)
{
if(isOpen)
{
Close();
}
else
{
Open();
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3c8b8a318ec4ab540aaf5c566b5d9de5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScoreManager : MonoBehaviour
{
List<ScoreSubject> scoreSubjectList;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 728973cb69f5b2d4b9a1ef0a634de34b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScoreSubject : MonoBehaviour
{
/// <summary>
/// 科目满分
/// </summary>
float maxScore;
/// <summary>
/// 科目得分
/// </summary>
float currentScore;
List<ScoreSubjectStep> steps;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 00415bfa520d2dd43b89c50a93350199
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScoreSubjectStep : MonoBehaviour
{
/// <summary>
/// 步骤满分
/// </summary>
float maxScore;
/// <summary>
/// 步骤得分
/// </summary>
float currentScore;
/// <summary>
/// 步骤是否已完成
/// </summary>
bool isDone;
public void SetScore(float score)
{
isDone = true;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: efc96f6a32601eb468d03debfd8d9661
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 20509a9c360dbfa448a36ca6eeaf639d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -22,6 +22,7 @@ public class Tool_Screw : Tool_Base
/// </summary>
public Transform installPos;
/// <summary>
/// 螺丝拧紧时的位置
/// </summary>
@ -32,6 +33,7 @@ public class Tool_Screw : Tool_Base
private float localYUnInstallValue;
/// <summary>
/// 被拧紧
@ -42,7 +44,7 @@ public class Tool_Screw : Tool_Base
//设置螺丝刀初始位置
screwdriver.transform.position = installPos.position;
//动画
transform.DOLocalMoveY(localYInstallValue, 1)
transform.DOLocalMoveY(transform.localPosition.y+0.02f, 1)
.OnUpdate(() =>
{
transform.RotateAroundLocal(Vector3.up, 1);
@ -56,7 +58,7 @@ public class Tool_Screw : Tool_Base
}
/// <summary>
/// ±»Å¡ËÍ
/// ±»Å¡ËÉ
/// </summary>
/// <param name="screwdriver"></param>
public void BeUnInstalled(Tool_Screwdriver screwdriver)
@ -64,7 +66,7 @@ public class Tool_Screw : Tool_Base
//设置螺丝刀初始位置
screwdriver.transform.position = installPos.position;
//动画
transform.DOLocalMoveY(localYUnInstallValue, 1)
transform.DOLocalMoveY(transform.localPosition.y - 0.02f, 1)
.OnUpdate(() =>
{
transform.RotateAroundLocal(Vector3.up, 1);

View File

@ -27,10 +27,47 @@ public class Tool_Screwdriver : Tool_Base
/// <param name="screw"></param>
public void UnInstall(Tool_Screw screw)
{
if (screw.isInstall)
if (screw.isInstall )
{
Debug.Log("¿ªÊ¼Ð¶ÂÝË¿");
screw.BeUnInstalled(this);
}
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
//点击螺丝验电
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(tmpray, out RaycastHit hit))
{
//插座
Tool_Screw ts = hit.transform.GetComponent<Tool_Screw>();
if (ts != null)
{
if(ts.id== "电能表盖子固定螺丝1" && !Device_DirectAccessElectricEnergyMeteringDevice.instance.cover_seal_Left.isCut)
{
Debug.Log("封印未剪断");
return;
}
if (ts.id == "电能表盖子固定螺丝2" && !Device_DirectAccessElectricEnergyMeteringDevice.instance.cover_seal_Right.isCut)
{
Debug.Log("封印未剪断");
return;
}
if (ts.isInstall)
{
UnInstall(ts);
}
else
{
Install(ts);
}
}
}
}
}
}

View File

@ -7,6 +7,33 @@ using UnityEngine;
/// </summary>
public class Tool_TestPen : Tool_Base
{
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
//µã»÷ÂÝË¿Ñéµç
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(tmpray, out RaycastHit hit))
{
//²å×ù
Device_Base db = hit.transform.GetComponent<Device_Base>();
if (db != null)
{
Test(db);
return;
}
//¹ñÃÅ
Tool_Base tb= hit.transform.GetComponent<Tool_Base>();
if(tb != null)
{
Test(tb);
return;
}
}
}
}
/// <summary>
/// 执行验电操作
/// </summary>

View File

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static Unity.Burst.Intrinsics.X86.Avx;
/// <summary>
/// °þÏßǯ
@ -8,12 +9,59 @@ using UnityEngine;
public class Tool_WireStripper : Tool_Base
{
/// <summary>
/// ¼ô·âÓ¡
/// 开始剪封印
/// </summary>
/// <param name="device_Seal"></param>
public void CutOpen(Device_Seal device_Seal)
{
device_Seal.isCut = true;
device_Seal.gameObject.SetActive(false);
transform.position = device_Seal.testPosAndRot.position;
transform.eulerAngles = device_Seal.testPosAndRot.eulerAngles;
//播放动画
StopAllCoroutines();
StartCoroutine(PlayAnimi(device_Seal));
}
/// <summary>
/// 剪的动画
/// </summary>
/// <returns></returns>
IEnumerator PlayAnimi(Device_Seal device_Seal)
{
SkinnedMeshRenderer renderer= GetComponentInChildren<SkinnedMeshRenderer>();
float vlaue = 0;
//打开
while (renderer.GetBlendShapeWeight(0) < 100)
{
vlaue += (Time.deltaTime * 50);
renderer.SetBlendShapeWeight(0, vlaue);
yield return null;
}
//关闭
while (renderer.GetBlendShapeWeight(0) > 0)
{
vlaue -= (Time.deltaTime * 50);
renderer.SetBlendShapeWeight(0, vlaue);
yield return null;
}
//剪断
device_Seal.Cut();
}
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
//点击螺丝验电
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(tmpray, out RaycastHit hit))
{
//封印
Device_Seal ds = hit.transform.GetComponent<Device_Seal>();
if (ds != null)
{
CutOpen(ds);
}
}
}
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -20,32 +21,41 @@ public class ProcessTipPanel : MonoBehaviour
/// </summary>
private bool isOver=false;
/// <summary>
/// 结果回调
/// </summary>
private Action<bool> tmpback;
/// <summary>
/// 设置进度
/// 开始走进度
/// </summary>
/// <param name="value"></param>
public void SetProcess(bool ischeck)
/// <param name="back"></param>
public void StartProcess(Action<bool> back)
{
this.isCheck = ischeck;
if(!ischeck )
{
currentProcess = 0;
image.fillAmount = currentProcess;
}
else
{
Debug.Log("开始核对和抄录");
}
this.isCheck=true;
tmpback = back;
Debug.Log("开始核对和抄录");
}
/// <summary>
/// 中止走进度
/// </summary>
public void StopProcess()
{
this.isCheck = false;
currentProcess = 0;
image.fillAmount = currentProcess;
tmpback(false);
}
void Update()
{
if (!isOver)
{
if (isCheck)
{
currentProcess = Mathf.Clamp01(currentProcess + Time.deltaTime * 0.1f);
currentProcess = Mathf.Clamp01(currentProcess + Time.deltaTime * 0.3f);
image.fillAmount = currentProcess;
if (currentProcess == 1)
{
@ -56,7 +66,7 @@ public class ProcessTipPanel : MonoBehaviour
if (Input.GetMouseButtonUp(0))
{
SetProcess(false);
StopProcess();
isOver = true;
Destroy(gameObject);
}
@ -69,6 +79,7 @@ public class ProcessTipPanel : MonoBehaviour
private void ThisDestroy()
{
Debug.Log("ºË¶ÔºÍ³­Â¼Íê³É£¡");
tmpback(true);
Destroy(gameObject);
}
}

View File

@ -196,8 +196,9 @@ public enum DeviceType
,
_柜门,
_插座,
,
_开关,
_铭牌,
_合格标志,
线,
线_开关,
线_铭牌,
线_接线盖子,
}