新科目

This commit is contained in:
陈向学 2024-09-04 15:12:10 +08:00
parent f36b14dcc6
commit e67b5836a1
26 changed files with 7182 additions and 10120 deletions

View File

@ -0,0 +1,322 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7175692158753146328
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8478404885969365012}
- component: {fileID: 2663764905760382546}
- component: {fileID: 2292098275725943769}
- component: {fileID: 6231094815727103799}
- component: {fileID: 8107479113973501736}
m_Layer: 0
m_Name: "\u6273\u624B"
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8478404885969365012
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7175692158753146328}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.263, y: -0.8240001, z: -2.3841999}
m_LocalScale: {x: 0.6, y: 0.6, z: 0.6}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7829523123839521089}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2663764905760382546
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7175692158753146328}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6f31a9609373b04faa317bc87afe550, type: 3}
m_Name:
m_EditorClassIdentifier:
itemInfo:
toolId: 0
triggerID: 0
toolName:
toolOrDeviceOrMaterial: 0
objPrefab: {fileID: 7175692158753146328}
selfPosInToolRoom: {x: 0, y: 0, z: 0}
_highlight: {fileID: 0}
--- !u!65 &2292098275725943769
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7175692158753146328}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.05094013, y: 0.05094013, z: 0.30404854}
m_Center: {x: 0, y: 0.00000011920929, z: -0.15774488}
--- !u!114 &6231094815727103799
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7175692158753146328}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 888380afc233049ce9e618f9f36c8ba8, type: 3}
m_Name:
m_EditorClassIdentifier:
profile: {fileID: 0}
profileSync: 0
camerasLayerMask:
serializedVersion: 2
m_Bits: 4294967295
effectGroup: 0
effectGroupLayer:
serializedVersion: 2
m_Bits: 4294967295
effectNameFilter:
combineMeshes: 0
alphaCutOff: 0
cullBackFaces: 1
ignoreObjectVisibility: 0
reflectionProbes: 0
GPUInstancing: 1
optimizeSkinnedMesh: 1
depthClip: 0
cameraDistanceFade: 0
cameraDistanceFadeNear: 0
cameraDistanceFadeFar: 1000
normalsOption: 0
ignore: 0
_highlighted: 0
fadeInDuration: 0
fadeOutDuration: 0
flipY: 0
constantWidth: 1
subMeshMask: -1
overlay: 0
overlayMode: 0
overlayColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1}
overlayAnimationSpeed: 1
overlayMinIntensity: 0.5
overlayBlending: 1
overlayTexture: {fileID: 0}
overlayTextureUVSpace: 0
overlayTextureScale: 1
overlayVisibility: 0
outline: 1
outlineColor: {r: 0.8080046, g: 1.6417967, b: 0.36961916, a: 1}
outlineColorStyle: 0
outlineGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
outlineGradientInLocalSpace: 0
outlineWidth: 0.45
outlineBlurPasses: 2
outlineQuality: 3
outlineEdgeMode: 0
outlineEdgeThreshold: 0.995
outlineDownsampling: 2
outlineVisibility: 0
glowBlendMode: 0
outlineBlitDebug: 0
outlineIndependent: 0
outlineContourStyle: 0
glow: 0.48
glowWidth: 0.4
glowQuality: 3
glowBlurMethod: 0
glowDownsampling: 2
glowHQColor: {r: 0.64, g: 1, b: 0, a: 1}
glowDithering: 1
glowMagicNumber1: 0.75
glowMagicNumber2: 0.5
glowAnimationSpeed: 1
glowVisibility: 0
glowBlitDebug: 0
glowBlendPasses: 1
glowPasses:
- offset: 4
alpha: 0.1
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 3
alpha: 0.2
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 2
alpha: 0.3
color: {r: 0.64, g: 1, b: 0, a: 1}
- offset: 1
alpha: 0.4
color: {r: 0.64, g: 1, b: 0, a: 1}
glowIgnoreMask: 0
innerGlow: 0
innerGlowWidth: 1
innerGlowColor: {r: 1, g: 1, b: 1, a: 1}
innerGlowBlendMode: 0
innerGlowVisibility: 0
targetFX: 0
targetFXTexture: {fileID: 0}
targetFXColor: {r: 1, g: 1, b: 1, a: 1}
targetFXCenter: {fileID: 0}
targetFXRotationSpeed: 50
targetFXInitialScale: 4
targetFXEndScale: 1.5
targetFXScaleToRenderBounds: 1
targetFXAlignToGround: 0
targetFXFadePower: 32
targetFXGroundMaxDistance: 10
targetFXGroundLayerMask:
serializedVersion: 2
m_Bits: 4294967295
targetFXTransitionDuration: 0.5
targetFXStayDuration: 1.5
targetFXVisibility: 1
seeThrough: 2
seeThroughOccluderMask:
serializedVersion: 2
m_Bits: 4294967295
seeThroughOccluderThreshold: 0.3
seeThroughOccluderMaskAccurate: 0
seeThroughOccluderCheckInterval: 1
seeThroughOccluderCheckIndividualObjects: 0
seeThroughDepthOffset: 0
seeThroughMaxDepth: 0
seeThroughIntensity: 0.8
seeThroughTintAlpha: 0.5
seeThroughTintColor: {r: 1, g: 0, b: 0, a: 1}
seeThroughNoise: 1
seeThroughBorder: 0
seeThroughBorderColor: {r: 0, g: 0, b: 0, a: 1}
seeThroughBorderOnly: 0
seeThroughBorderWidth: 0.45
seeThroughOrdered: 0
seeThroughTexture: {fileID: 0}
seeThroughTextureUVSpace: 0
seeThroughTextureScale: 1
rmsCount: 0
hitFxInitialIntensity: 0
hitFxMode: 0
hitFxFadeOutDuration: 0.25
hitFxColor: {r: 1, g: 1, b: 1, a: 1}
hitFxRadius: 0.5
--- !u!114 &8107479113973501736
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7175692158753146328}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2b1c0381e13cf194e9f51a8e709b2521, type: 3}
m_Name:
m_EditorClassIdentifier:
triggerID: 0
triggerName: "\u6273\u624B"
_highlight: {fileID: 0}
toolType: 0
isMoving: 0
--- !u!1001 &7719931383897142954
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 8478404885969365012}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalPosition.z
value: -0.15680003
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalRotation.w
value: 0.00000008146034
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalRotation.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 18e3d012d42595243afc97129c371624, type: 3}
propertyPath: m_Name
value: "\u7EDD\u7F18\u87BA\u4E1D\u5200"
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 18e3d012d42595243afc97129c371624, type: 3}
--- !u!4 &7829523123839521089 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 18e3d012d42595243afc97129c371624, type: 3}
m_PrefabInstance: {fileID: 7719931383897142954}
m_PrefabAsset: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0b405bfbb773f53459096a458d4a2c33
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,3 +1,4 @@
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
@ -78,4 +79,23 @@ public class Device_Base : PermanentTriggerBase
this.head_LocalPos = head_LocalPos;
this.head_LocalEulerAnglesl = head_LocalEulerAnglesl;
}
/// <summary>
/// »Øµ½ÊÖÖÐ
/// </summary>
/// <param name="back"></param>
public void ReBackHead(Action back = null)
{
isMoving = true;
transform.parent = Camera.main.transform;
transform.DOLocalRotate(head_LocalEulerAnglesl, 0.3f);
transform.DOLocalMove(head_LocalPos, 0.8f).OnComplete(() =>
{
transform.localPosition = head_LocalPos;
transform.localEulerAngles = head_LocalEulerAnglesl;
isMoving = false;
hand_back_action?.Invoke();
back?.Invoke();
});
}
}

View File

@ -1,3 +1,4 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -7,5 +8,65 @@ using UnityEngine;
/// </summary>
public class Device_LowVoltageCurrentTransformer : Device_Base
{
public bool isInstall;
protected override void OnMDown()
{
base.OnMDown();
if (isInstall)
{
Remove(transform.parent.GetComponent<Device_ConductiveSheet>());
}
}
/// <summary>
/// 安装到导电片上
/// </summary>
public void Add(Device_ConductiveSheet Sheet)
{
if (!isInstall && !isMoving && !Sheet.isInstall)
{
isMoving = true;
transform.parent = Sheet.transform;
Sheet.transformer = this;
Sheet.LowVoltageCurrentTransformer_Trigger.gameObject.SetActive(false);
isInstall = true;
hand_out_action?.Invoke();
//从手里飞到铁片下面
transform.DOLocalMove(new Vector3(-0.31f, -14.41f, 1.21f), 2).OnStart(() =>
{
transform.localEulerAngles = new Vector3(-90, 0, 90);
}).OnComplete(() =>
{
//套上去
transform.DOLocalMove(new Vector3(-0.31f, -3.36f, 1.21f), 1).OnComplete(() =>
{
Debug.Log("低压电流互感器已安装");
triggerAction?.Invoke(triggerName, true);
CallScoreAction(true);
});
});
}
}
/// <summary>
/// 拆除
/// </summary>
public void Remove(Device_ConductiveSheet Sheet)
{
if(isInstall && !isMoving && !Sheet.isInstall)
{
isMoving = true;
Sheet.transformer = null;
//套下去
transform.DOLocalMove(new Vector3(-0.31f, -14.41f, 1.21f), 1).OnComplete(() =>
{
Debug.Log("低压电流互感器已拆除");
triggerAction?.Invoke(triggerName, true);
CallScoreAction(true);
//回到手中
base.ReBackHead();
});
}
}
}

View File

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

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// ¼ÆÁ¿¹ñ_
/// 10002_1002_¼ÆÁ¿×°ÖÃÂÖ»»
/// </summary>
public class Device_Control_1002 : Device_Control
{
@ -71,6 +71,7 @@ public class Device_Control_1002 : Device_Control
{
meteringDevice = LiveSceneManager.Instance.currentTool.GetComponent<Device_3Phase4WireMeter>();
meteringDevice.Add(this);
//接线完好关联螺丝重新赋值
check_JieXian.tool_Screws = meteringDevice.jieXian_screws;
//接线关联螺丝
@ -86,13 +87,19 @@ public class Device_Control_1002 : Device_Control
else
{
//拆下电能表
meteringDevice.Remove(this);
meteringDevice.Remove(a =>
{
if (a)
{
meteringDevice = null;
//情况接线关联螺丝
ClearLineScrew();
sundries.gameObject.SetActive(true);
//打分
dianTrigger.CallScoreAction(false);
}
});
}
}
};
}

View File

@ -0,0 +1,72 @@
using Sirenix.Utilities;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 10001_2001_经互感器接入式低压电能计量装置
/// </summary>
public class Device_Control_2001 : Device_Control
{
/// <summary>
/// 当前机柜中安装的三相四线电能表
/// </summary>
public Device_3Phase4WireMeter meteringDevice;
/// <summary>
/// 柜门
/// </summary>
public Device_CabinetDoor cabinetDoor;
/// <summary>
/// 3个导电片
/// </summary>
public List<Device_ConductiveSheet> device_ConductiveSheets;
private void Awake()
{
//设置控制脚本
StepStateControl.instance.SetDeviceControl(2001, this);
ScoreManager.instance.SetDeviceControl(2001, this);
EventCenter.Instance.AddEventListener<GameObject>(Enum_EventType.TakeOutAndRetrievingTheTools, OnHandTool);
//添加互感器触发点击回调
device_ConductiveSheets.ForEach(a =>
{
a.LowVoltageCurrentTransformer_Trigger.clickAction += () =>
{
//拿着低压电流互感器
if (LiveSceneManager.Instance.currentTool!=null && LiveSceneManager.Instance.currentTool.name== "低压电流互感器")
{
//安装
LiveSceneManager.Instance.currentTool.GetComponent<Device_LowVoltageCurrentTransformer>().Add(a);
}
};
});
}
private void OnHandTool(GameObject obj)
{
if (obj == null)
{
//收回
device_ConductiveSheets.ForEach(a =>
{
a.LowVoltageCurrentTransformer_Trigger.gameObject.SetActive(false);
});
}
else
{
if(obj.name== "低压电流互感器")
{
//拿出
device_ConductiveSheets.ForEach(a =>
{
if(a.transformer==null)
{
a.LowVoltageCurrentTransformer_Trigger.gameObject.SetActive(true);
}
});
}
}
}
}

View File

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

View File

@ -1,5 +1,6 @@
using DG.Tweening;
using Sirenix.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@ -180,13 +181,13 @@ public class Device_3Phase4WireMeter : Device_Base
/// <summary>
/// 拆下电能表
/// </summary>
public void Remove(Device_Control_1002 device_MeasuringCabinet)
public void Remove(Action<bool> callback)
{
//拆下电能表
if (!fix_screw_left.isInstall && !fix_screw_right.isInstall)
{
callback(true);
hand_out_action?.Invoke();
device_MeasuringCabinet.meteringDevice = null;
Debug.Log("电能表已拆除");
transform.DOLocalMove(transform.localPosition - new Vector3(0, 0.2f, 0.2f), 2).OnComplete(() =>
{
@ -194,19 +195,23 @@ public class Device_3Phase4WireMeter : Device_Base
gameObject.SetActive(false);
});
}
else
{
callback(false);
}
}
/// <summary>
/// 安装电能表
/// 安装电能表到柜子上
/// </summary>
public void Add(Device_Control_1002 device_MeasuringCabinet)
public void Add(Device_Control control)
{
transform.parent = device_MeasuringCabinet.transform;
device_MeasuringCabinet.meteringDevice = this;
transform.parent = control.transform;
transform.GetComponentsInChildren<PermanentTriggerBase>(true).ToList().ForEach(a => a.Awake());
//默认是拆除的状态
Init(false);
hand_out_action?.Invoke();
//从手里飞过去
transform.DOLocalMove(new Vector3(0.1469002f, -0.1793365f, 0.5191498f), 2).OnStart(() =>
{
transform.localEulerAngles = Vector3.zero;

View File

@ -28,7 +28,7 @@ public class Device_CabinetDoor : Device_Base
transform.Find("¼ÆÁ¿¹ñËø2/¼ÆÁ¿¹ñËø3").DOLocalRotate(new Vector3(-45f, 0, 0), 1).OnComplete(() =>
{
//¿ªÃÅ
transform.DOLocalRotate(new Vector3(0, 0, 180), 3).OnComplete(() =>
transform.DOLocalRotate(new Vector3(0, 0, 170), 3).OnComplete(() =>
{
isOpen = true;
int result = (triggerAction == null ? 0 : triggerAction.Invoke(triggerName, true));
@ -75,7 +75,7 @@ public class Device_CabinetDoor : Device_Base
public void OpenState()
{
isOpen = true;
transform.localEulerAngles = new Vector3(0, 0, 180);
transform.localEulerAngles = new Vector3(0, 0, 170);
transform.Find("¼ÆÁ¿¹ñËø2/¼ÆÁ¿¹ñËø3").localEulerAngles = new Vector3(-45f, 0, 0);
}

View File

@ -0,0 +1,53 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 导电片
/// </summary>
public class Device_ConductiveSheet : Device_Base
{
public bool isInstall;
/// <summary>
/// 铁片固定扳手螺丝
/// </summary>
public Tool_SpannerScrew screw;
/// <summary>
///低压电流互感器安装触发区
/// </summary>
public DeviceTrigger LowVoltageCurrentTransformer_Trigger;
/// <summary>
/// 低压电流互感器
/// </summary>
public Device_LowVoltageCurrentTransformer transformer;
protected override void OnMDown()
{
base.OnMDown();
if (!screw.isInstall)
{
if (triggerAction?.Invoke(triggerName, false) == 0)
{
if (isInstall)
{
//合上
transform.DOLocalRotate(new Vector3(0, 0, 25), 0.5f).OnComplete(() =>
{
isInstall = true;
base.CallScoreAction(true);
});
}
else
{
//打开
transform.DOLocalRotate(new Vector3(0, 0, 0), 0.5f).OnComplete(() =>
{
isInstall = false;
base.CallScoreAction(false);
});
}
}
}
}
}

View File

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

View File

@ -30,7 +30,7 @@ public class Tool_Base : PermanentTriggerBase
protected override void OnAwake()
{
if (GameManager.RunModelMgr.SceneType == E_SceneType.Site)
if (GameManager.RunModelMgr?.SceneType == E_SceneType.Site)
{
base.OnAwake();
}

View File

@ -27,7 +27,7 @@ public class Tool_Multimeter : Tool_Base
//슥직든箕도할던든
if(pen_宮窟.currentScrew!=null && pen_宮窟.currentScrew.hasElectricity)
{
if (pen_ĎŕĎß.currentScrew.id.Contains("in"))
if (pen_ĎŕĎß.currentScrew.triggerName.Contains("in"))
{
}

View File

@ -5,15 +5,10 @@ using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// ÂÝË¿
/// ハョラヨツンヒソ
/// </summary>
public class Tool_Screw : Tool_Base
{
/// <summary>
/// ±êʶ
/// </summary>
public string id;
/// <summary>
/// 是否已拧紧
/// </summary>

View File

@ -1,7 +1,6 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
/// <summary>

View File

@ -0,0 +1,86 @@
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 扳手
/// </summary>
public class Tool_Spanner : Tool_Base
{
/// <summary>
/// 开始安装螺丝
/// </summary>
/// <param name="screw"></param>
public void Install(Tool_SpannerScrew screw)
{
if (!screw.isInstall && !screw.isMoving && !isMoving)
{
screw.isMoving = true;
isMoving = true;
Debug.Log("开始拧紧螺丝");
hand_out_action?.Invoke();
//螺丝刀移到螺丝上
transform.parent = null;
transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f);
transform.DOMove(screw.installPos.position, 1).OnComplete(() =>
{
screw.BeInstalled(this);
});
}
}
/// <summary>
/// 开始卸载螺丝
/// </summary>
/// <param name="screw"></param>
public void UnInstall(Tool_SpannerScrew screw)
{
if (screw.isInstall && !screw.isMoving && !isMoving)
{
screw.isMoving = true;
isMoving = true;
Debug.Log("开始卸螺丝");
hand_out_action?.Invoke();
//螺丝刀移到螺丝处
transform.parent = null;
transform.DOLocalRotate(screw.installPos.localEulerAngles, 0.5f);
transform.DOMove(screw.installPos.position, 1).OnComplete(() =>
{
screw.BeUnInstalled(this);
});
}
}
private void Update()
{
if (Input.GetMouseButtonDown(0) && !base.isMoving)
{
//点击螺丝验电
Ray tmpray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(tmpray, out RaycastHit hit))
{
//螺丝
Tool_SpannerScrew ts = hit.transform.GetComponent<Tool_SpannerScrew>();
if (ts != null)
{
//螺丝判断条件,是否可以拧
if (ts.CanMove())
{
if ((triggerAction == null ? 0 : triggerAction.Invoke(ts.triggerName, true)) == 0)
{
if (ts.isInstall)
{
UnInstall(ts);
}
else
{
Install(ts);
}
}
}
}
}
}
}
}

View File

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

View File

@ -0,0 +1,120 @@
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 扳手螺丝
/// </summary>
public class Tool_SpannerScrew : Tool_Base
{
/// <summary>
/// 是否已拧紧
/// </summary>
public bool isInstall;
/// <summary>
/// 上螺丝位置
/// </summary>
public Transform installPos;
/// <summary>
/// 是否带电
/// </summary>
public bool hasElectricity;
/// <summary>
/// 安装状态时Y的local值
/// </summary>
public float initPostionY;
/// <summary>
/// 螺丝拆装事件回调
/// </summary>
private Action<bool> installAction;
/// <summary>
/// 螺丝判断条件回调
/// </summary>
private Func<bool> checkCanMove;
public void AddinstallAction(Action<bool> action)
{
this.installAction = action;
}
public void AddCheckAction(Func<bool> checkCanMove)
{
this.checkCanMove = checkCanMove;
}
protected override void OnMDown()
{
base.OnMDown();
}
/// <summary>
/// 螺丝是否可以拧
/// </summary>
/// <returns></returns>
public bool CanMove()
{
if (checkCanMove == null)
{
return true;
}
else
{
return checkCanMove.Invoke();
}
}
/// <summary>
/// 被拧紧
/// </summary>
/// <param name="screwdriver"></param>
public void BeInstalled(Tool_Spanner screwdriver)
{
//动画
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>
/// 被拧松
/// </summary>
/// <param name="screwdriver"></param>
public void BeUnInstalled(Tool_Spanner screwdriver)
{
//动画
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);
});
}
}

View File

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

View File

@ -203,5 +203,6 @@ public enum DeviceType
线_铭牌,
线_接线盖子,
,
,
}

View File

@ -38,8 +38,10 @@ public class PermanentTriggerBase : MonoBehaviour
{
isInit = true;
OnAwake();
if (ScoreManager.instance != null)
{
AddScoreAction(ScoreManager.instance.Check);
}
}
}

View File

@ -29,8 +29,8 @@ public abstract class BaseToolOrDevice : MonoBehaviour
private void Awake()
{
_highlight = GetComponent<HighlightEffect>();
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)
GameManager.EventMgr.AddEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
if (GameManager.RunModelMgr?.ModeType == E_ModeType.Study)
GameManager.EventMgr?.AddEventListener<string>(Enum_EventType.SwitchSubProcessStepTriggerID, SwitchSubProcessStepTriggerID);
}
private void SwitchSubProcessStepTriggerID(string arg0)