This commit is contained in:
parent
3e03b0ee3a
commit
857555fa4c
|
@ -0,0 +1,157 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
using System.Collections;
|
||||||
|
using Unity.EditorCoroutines.Editor;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public class ModelColliderEditor : EditorWindow
|
||||||
|
{
|
||||||
|
private static float firstLayerMoveDistance = 1; // 第一层的移动距离
|
||||||
|
private static float explosionDuration = 1f; // 爆炸动画持续时间
|
||||||
|
|
||||||
|
private static readonly string[] Directions = {
|
||||||
|
"前", "后", "左", "右",
|
||||||
|
"上", "下", "前上", "前下",
|
||||||
|
"后上", "后下", "左上", "左下",
|
||||||
|
"右上", "右下"
|
||||||
|
};
|
||||||
|
|
||||||
|
[MenuItem("Tools/Add Mesh Colliders")]
|
||||||
|
public static void AddMeshColliders()
|
||||||
|
{
|
||||||
|
GameObject selectedObject = Selection.activeGameObject;
|
||||||
|
|
||||||
|
if (selectedObject == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("No object selected.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 遍历第一层级子物体
|
||||||
|
foreach (Transform child in selectedObject.transform)
|
||||||
|
{
|
||||||
|
AddMeshColliderAndDirection(child, selectedObject.name); // 直接调用处理函数
|
||||||
|
|
||||||
|
// 递归添加给子物体
|
||||||
|
AddMeshCollidersToChildren(child); // 使用自身位置作为新的中心
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddMeshCollidersToChildren(Transform parent)
|
||||||
|
{
|
||||||
|
foreach (Transform child in parent)
|
||||||
|
{
|
||||||
|
AddMeshColliderAndDirection(child, parent.name); // 直接调用处理函数
|
||||||
|
|
||||||
|
// 递归调用
|
||||||
|
AddMeshCollidersToChildren(child); // 计算子物体的中心
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddMeshColliderAndDirection(Transform child, string parentName)
|
||||||
|
{
|
||||||
|
// 添加 MeshCollider
|
||||||
|
if (child.GetComponent<MeshCollider>() == null)
|
||||||
|
{
|
||||||
|
child.gameObject.AddComponent<MeshCollider>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加 ModelChilderComponent 脚本
|
||||||
|
ModelChilderComponent component = child.gameObject.AddComponent<ModelChilderComponent>();
|
||||||
|
component.Parent = parentName;
|
||||||
|
|
||||||
|
// 随机选择方位
|
||||||
|
string randomDirection = Directions[Random.Range(0, Directions.Length)];
|
||||||
|
component.Direction = randomDirection;
|
||||||
|
|
||||||
|
Debug.Log($"{child.name} is at {component.Direction} from its parent.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("Tools/Explode Objects")]
|
||||||
|
public static void ExplodeObjects()
|
||||||
|
{
|
||||||
|
GameObject selectedObject = Selection.activeGameObject;
|
||||||
|
|
||||||
|
if (selectedObject == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("No object selected.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Transform child in selectedObject.transform)
|
||||||
|
{
|
||||||
|
EditorCoroutineUtility.StartCoroutine(Explode(child), child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerator Explode(Transform parent)
|
||||||
|
{
|
||||||
|
float moveDistance = CalculateMoveDistance(0); // 假设为第一层
|
||||||
|
Vector3 targetPosition = GetTargetPosition(parent, moveDistance);
|
||||||
|
|
||||||
|
float elapsedTime = 0f;
|
||||||
|
Vector3 startingPosition = parent.localPosition;
|
||||||
|
|
||||||
|
while (elapsedTime < explosionDuration)
|
||||||
|
{
|
||||||
|
float t = elapsedTime / explosionDuration;
|
||||||
|
parent.localPosition = Vector3.Lerp(startingPosition, targetPosition, t);
|
||||||
|
elapsedTime += Time.deltaTime;
|
||||||
|
yield return null; // 等待下一帧
|
||||||
|
}
|
||||||
|
|
||||||
|
parent.localPosition = targetPosition; // 确保最终位置
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Vector3 GetTargetPosition(Transform child, float distance)
|
||||||
|
{
|
||||||
|
string direction = child.GetComponent<ModelChilderComponent>()?.Direction;
|
||||||
|
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case "前":
|
||||||
|
return child.localPosition + new Vector3(0, 0, distance);
|
||||||
|
case "后":
|
||||||
|
return child.localPosition + new Vector3(0, 0, -distance);
|
||||||
|
case "左":
|
||||||
|
return child.localPosition + new Vector3(-distance, 0, 0);
|
||||||
|
case "右":
|
||||||
|
return child.localPosition + new Vector3(distance, 0, 0);
|
||||||
|
case "上":
|
||||||
|
return child.localPosition + new Vector3(0, distance, 0);
|
||||||
|
case "下":
|
||||||
|
return child.localPosition + new Vector3(0, -distance, 0);
|
||||||
|
case "前上":
|
||||||
|
return child.localPosition + new Vector3(0, distance, distance);
|
||||||
|
case "前下":
|
||||||
|
return child.localPosition + new Vector3(0, -distance, distance);
|
||||||
|
case "后上":
|
||||||
|
return child.localPosition + new Vector3(0, distance, -distance);
|
||||||
|
case "后下":
|
||||||
|
return child.localPosition + new Vector3(0, -distance, -distance);
|
||||||
|
case "左上":
|
||||||
|
return child.localPosition + new Vector3(-distance, distance, 0);
|
||||||
|
case "左下":
|
||||||
|
return child.localPosition + new Vector3(-distance, -distance, 0);
|
||||||
|
case "右上":
|
||||||
|
return child.localPosition + new Vector3(distance, distance, 0);
|
||||||
|
case "右下":
|
||||||
|
return child.localPosition + new Vector3(distance, -distance, 0);
|
||||||
|
default:
|
||||||
|
return child.localPosition; // 默认不移动
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float CalculateMoveDistance(int level)
|
||||||
|
{
|
||||||
|
if (level == 0)
|
||||||
|
return firstLayerMoveDistance; // 第一层的移动距离
|
||||||
|
else if (level == 1)
|
||||||
|
return 7f; // 第二层的移动距离
|
||||||
|
else if (level == 2)
|
||||||
|
return 5f; // 第三层的移动距离
|
||||||
|
return 0f; // 更深层次不移动
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5bbbbd9ed8334c9aa2e509df5f18f268
|
||||||
|
timeCreated: 1730686041
|
|
@ -0,0 +1,246 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1102 &-7192261185259158979
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Take 001 0
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: 5776237462789136407}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 1827226128182048838, guid: fb7298f30cfa5ae4eaf512f471e507b5, type: 3}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
--- !u!1101 &-5933228636309739764
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 1
|
||||||
|
m_ConditionEvent: "\u62C6\u5206"
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 6644890916647427872}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.75
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1102 &-3529673797996298932
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: New State
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: -5933228636309739764}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 0}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
--- !u!91 &9100000
|
||||||
|
AnimatorController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: "\u5FEB\u6362\u7535\u6C601"
|
||||||
|
serializedVersion: 5
|
||||||
|
m_AnimatorParameters:
|
||||||
|
- m_Name: "\u62C6\u5206"
|
||||||
|
m_Type: 4
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
|
- m_Name: "\u5012\u653E"
|
||||||
|
m_Type: 4
|
||||||
|
m_DefaultFloat: 0
|
||||||
|
m_DefaultInt: 0
|
||||||
|
m_DefaultBool: 0
|
||||||
|
m_Controller: {fileID: 0}
|
||||||
|
m_AnimatorLayers:
|
||||||
|
- serializedVersion: 5
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_StateMachine: {fileID: 7616709574934098558}
|
||||||
|
m_Mask: {fileID: 0}
|
||||||
|
m_Motions: []
|
||||||
|
m_Behaviours: []
|
||||||
|
m_BlendingMode: 0
|
||||||
|
m_SyncedLayerIndex: -1
|
||||||
|
m_DefaultWeight: 0
|
||||||
|
m_IKPass: 0
|
||||||
|
m_SyncedLayerAffectsTiming: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
|
--- !u!1101 &993612836927862416
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 2
|
||||||
|
m_ConditionEvent: "\u62C6\u5206"
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -3529673797996298932}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.9791667
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &4611912014660958465
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 1
|
||||||
|
m_ConditionEvent: "\u5012\u653E"
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -7192261185259158979}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.85
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1101 &5776237462789136407
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions:
|
||||||
|
- m_ConditionMode: 2
|
||||||
|
m_ConditionEvent: "\u5012\u653E"
|
||||||
|
m_EventTreshold: 0
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 6644890916647427872}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.85
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
|
--- !u!1102 &6644890916647427872
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Take 001
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions:
|
||||||
|
- {fileID: 993612836927862416}
|
||||||
|
- {fileID: 4611912014660958465}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 1827226128182048838, guid: fb7298f30cfa5ae4eaf512f471e507b5, type: 3}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
--- !u!1107 &7616709574934098558
|
||||||
|
AnimatorStateMachine:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_ChildStates:
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: -3529673797996298932}
|
||||||
|
m_Position: {x: 300, y: 80, z: 0}
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: 6644890916647427872}
|
||||||
|
m_Position: {x: 350, y: 290, z: 0}
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: -7192261185259158979}
|
||||||
|
m_Position: {x: 570, y: 80, z: 0}
|
||||||
|
m_ChildStateMachines: []
|
||||||
|
m_AnyStateTransitions: []
|
||||||
|
m_EntryTransitions: []
|
||||||
|
m_StateMachineTransitions: {}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||||
|
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||||
|
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||||
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
|
m_DefaultState: {fileID: -3529673797996298932}
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2bda3061191089946afc8f160925801d
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 9100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -86,7 +86,11 @@ namespace cakeslice
|
||||||
|
|
||||||
OutlineEffect.Instance.outlines.Clear();
|
OutlineEffect.Instance.outlines.Clear();
|
||||||
}
|
}
|
||||||
OutlineEffect.Instance?.AddOutline(this);
|
if (gameObject==this.gameObject)
|
||||||
|
{
|
||||||
|
OutlineEffect.Instance?.AddOutline(this);
|
||||||
|
Debug.Log("添加自身");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void OnMouseUp()
|
//private void OnMouseUp()
|
||||||
|
|
|
@ -13,7 +13,6 @@ GameObject:
|
||||||
- component: {fileID: 117189262902970689}
|
- component: {fileID: 117189262902970689}
|
||||||
- component: {fileID: 4979577903660582703}
|
- component: {fileID: 4979577903660582703}
|
||||||
- component: {fileID: 1399729468017968744}
|
- component: {fileID: 1399729468017968744}
|
||||||
- component: {fileID: 4250281626495093301}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: "\u70DF\u7BB1_\u65E0\u52A8\u753B (1)"
|
m_Name: "\u70DF\u7BB1_\u65E0\u52A8\u753B (1)"
|
||||||
m_TagString: Box
|
m_TagString: Box
|
||||||
|
@ -102,7 +101,7 @@ BoxCollider:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 0
|
m_Bits: 0
|
||||||
m_LayerOverridePriority: 0
|
m_LayerOverridePriority: 0
|
||||||
m_IsTrigger: 1
|
m_IsTrigger: 0
|
||||||
m_ProvidesContacts: 0
|
m_ProvidesContacts: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
|
@ -135,18 +134,6 @@ Rigidbody:
|
||||||
m_Interpolate: 0
|
m_Interpolate: 0
|
||||||
m_Constraints: 0
|
m_Constraints: 0
|
||||||
m_CollisionDetection: 0
|
m_CollisionDetection: 0
|
||||||
--- !u!114 &4250281626495093301
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1918721954697570452}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: ef5411e111cb04441a761bc6cf9a1fc6, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!1 &8394354781393860194
|
--- !u!1 &8394354781393860194
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ExplodeGUI : MonoBehaviour
|
||||||
|
{
|
||||||
|
private ExplodeOnClick explodeOnClick;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
// 获取 ExplodeOnClick 组件
|
||||||
|
explodeOnClick = FindObjectOfType<ExplodeOnClick>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGUI()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (GUI.Button(new Rect(10, 50, 100, 30), "爆炸"))
|
||||||
|
{
|
||||||
|
explodeOnClick?.Explode();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUI.Button(new Rect(10, 0, 100, 30), "复原"))
|
||||||
|
{
|
||||||
|
explodeOnClick?.ResetPositions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2a673f851c674cdda5873098faafb5d2
|
||||||
|
timeCreated: 1730697290
|
|
@ -0,0 +1,236 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
|
using Unity.VisualScripting;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ExplodeOnClick : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Transform parentObject;
|
||||||
|
private Vector3[] originalPositions; // 存储原始位置
|
||||||
|
private bool isExploded = false; // 标识是否已爆炸
|
||||||
|
public List<Vector3> points;
|
||||||
|
public List<GameObject> Replacebattery = new List<GameObject>();
|
||||||
|
private bool isp = false;
|
||||||
|
private GameObject Opjgame;
|
||||||
|
public List<Vector3> colidpoints;
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < parentObject.childCount; i++)
|
||||||
|
{
|
||||||
|
points.Add(parentObject.GetChild(i).localPosition);
|
||||||
|
Replacebattery.Add(parentObject.GetChild(i).gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetMouseButtonDown(0) && isExploded) // 鼠标左键点击
|
||||||
|
{
|
||||||
|
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||||
|
RaycastHit hit;
|
||||||
|
|
||||||
|
if (Physics.Raycast(ray, out hit))
|
||||||
|
{
|
||||||
|
if (Namedata(hit.collider.gameObject.transform.parent.name))
|
||||||
|
{
|
||||||
|
Debug.Log("有相同名字");
|
||||||
|
Debug.Log(hit.collider.gameObject.transform.parent.name);
|
||||||
|
Showdata(hit.collider.gameObject.transform.parent.name);
|
||||||
|
Opjgame = hit.collider.gameObject.transform.parent.gameObject;
|
||||||
|
}
|
||||||
|
// 检查点击的物体是否有 ModelChilderComponent
|
||||||
|
//ModelChilderComponent childComponent = hit.transform.GetComponent<ModelChilderComponent>();
|
||||||
|
//if (childComponent != null)
|
||||||
|
//{
|
||||||
|
// parentObject = hit.transform.parent; // 保存父对象
|
||||||
|
// originalPositions = new Vector3[parentObject.childCount]; // 初始化原始位置数组
|
||||||
|
|
||||||
|
// // 保存原始位置
|
||||||
|
// for (int i = 0; i < parentObject.childCount; i++)
|
||||||
|
// {
|
||||||
|
// originalPositions[i] = parentObject.GetChild(i).localPosition;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Show()
|
||||||
|
{
|
||||||
|
if (Replacebattery.Count > 0)
|
||||||
|
{
|
||||||
|
for(int i = 0;i < Replacebattery.Count; i++)
|
||||||
|
{
|
||||||
|
Replacebattery[i].gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 子物体实现爆炸效果
|
||||||
|
/// </summary>
|
||||||
|
public void Blowup()
|
||||||
|
{
|
||||||
|
if (!isp && Opjgame)
|
||||||
|
{
|
||||||
|
if (colidpoints.Count > 0)
|
||||||
|
{
|
||||||
|
colidpoints.Clear();
|
||||||
|
}
|
||||||
|
foreach (Transform child in Opjgame.transform)
|
||||||
|
{
|
||||||
|
colidpoints.Add(child.localPosition);
|
||||||
|
float moveDistance = CalculateMoveDistance(1);
|
||||||
|
Vector3 targetPosition = GetTargetPosition(child.transform, moveDistance);
|
||||||
|
StartCoroutine(MoveToPosition(child, targetPosition));
|
||||||
|
}
|
||||||
|
isp = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 还原子物体
|
||||||
|
/// </summary>
|
||||||
|
public void Restore()
|
||||||
|
{
|
||||||
|
if (isp && Opjgame)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Opjgame.transform.childCount; i++)
|
||||||
|
{
|
||||||
|
Transform child = Opjgame.transform.GetChild(i);
|
||||||
|
StartCoroutine(MoveToPosition(child, colidpoints[i]));
|
||||||
|
}
|
||||||
|
isp = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Explode()
|
||||||
|
{
|
||||||
|
if (!isExploded)
|
||||||
|
{
|
||||||
|
foreach (Transform child in parentObject)
|
||||||
|
{
|
||||||
|
float moveDistance = CalculateMoveDistance(0); // 假设为第一层
|
||||||
|
Vector3 targetPosition = GetTargetPosition(child, moveDistance);
|
||||||
|
|
||||||
|
// 这里可以实现动画效果,比如使用协程来移动物体
|
||||||
|
StartCoroutine(MoveToPosition(child, targetPosition));
|
||||||
|
}
|
||||||
|
isExploded = true; // 标记为已爆炸
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetPositions() // 复原位置的方法
|
||||||
|
{
|
||||||
|
if (isExploded)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < parentObject.childCount; i++)
|
||||||
|
{
|
||||||
|
Transform child = parentObject.GetChild(i);
|
||||||
|
StartCoroutine(MoveToPosition(child, points[i]));
|
||||||
|
}
|
||||||
|
isExploded = false; // 标记为未爆炸
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator MoveToPosition(Transform child, Vector3 targetPosition)
|
||||||
|
{
|
||||||
|
float elapsedTime = 0f;
|
||||||
|
Vector3 startingPosition = child.localPosition;
|
||||||
|
|
||||||
|
while (elapsedTime < 1f) // 1秒内完成移动
|
||||||
|
{
|
||||||
|
child.localPosition = Vector3.Lerp(startingPosition, targetPosition, elapsedTime);
|
||||||
|
elapsedTime += Time.deltaTime;
|
||||||
|
yield return null; // 等待下一帧
|
||||||
|
}
|
||||||
|
|
||||||
|
child.localPosition = targetPosition; // 确保最终位置
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector3 GetTargetPosition(Transform child, float distance)
|
||||||
|
{
|
||||||
|
string direction = child.GetComponent<ModelChilderComponent>()?.Direction;
|
||||||
|
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case "前":
|
||||||
|
return child.localPosition + new Vector3(0, 0, distance);
|
||||||
|
case "后":
|
||||||
|
return child.localPosition + new Vector3(0, 0, -distance);
|
||||||
|
case "左":
|
||||||
|
return child.localPosition + new Vector3(-distance, 0, 0);
|
||||||
|
case "右":
|
||||||
|
return child.localPosition + new Vector3(distance, 0, 0);
|
||||||
|
case "上":
|
||||||
|
return child.localPosition + new Vector3(0, distance, 0);
|
||||||
|
case "下":
|
||||||
|
return child.localPosition + new Vector3(0, -distance, 0);
|
||||||
|
case "前上":
|
||||||
|
return child.localPosition + new Vector3(0, distance, distance);
|
||||||
|
case "前下":
|
||||||
|
return child.localPosition + new Vector3(0, -distance, distance);
|
||||||
|
case "后上":
|
||||||
|
return child.localPosition + new Vector3(0, distance, -distance);
|
||||||
|
case "后下":
|
||||||
|
return child.localPosition + new Vector3(0, -distance, -distance);
|
||||||
|
case "左上":
|
||||||
|
return child.localPosition + new Vector3(-distance, distance, 0);
|
||||||
|
case "左下":
|
||||||
|
return child.localPosition + new Vector3(-distance, -distance, 0);
|
||||||
|
case "右上":
|
||||||
|
return child.localPosition + new Vector3(distance, distance, 0);
|
||||||
|
case "右下":
|
||||||
|
return child.localPosition + new Vector3(distance, -distance, 0);
|
||||||
|
default:
|
||||||
|
return child.localPosition; // 默认不移动
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float CalculateMoveDistance(int level)
|
||||||
|
{
|
||||||
|
if (level == 0)
|
||||||
|
return 5; // 自定义第一层的移动距离
|
||||||
|
else if (level == 1)
|
||||||
|
return 3f; // 第二层的移动距离
|
||||||
|
else if (level == 2)
|
||||||
|
return 1f; // 第三层的移动距离
|
||||||
|
return 0f; // 更深层次不移动
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 判断链表是否有这个名字
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool Namedata(string name)
|
||||||
|
{
|
||||||
|
if (Replacebattery.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Replacebattery.Count; i++)
|
||||||
|
{
|
||||||
|
if (Replacebattery[i].name == name)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 展示对应的子物体
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
public void Showdata(string name)
|
||||||
|
{
|
||||||
|
if (Replacebattery.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Replacebattery.Count; i++)
|
||||||
|
{
|
||||||
|
if (Replacebattery[i].name == name)
|
||||||
|
{
|
||||||
|
Replacebattery[i].SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Replacebattery[i].SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4aaf1662ad16ab44bb0d4ef3fac49a1a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class ModelChilderComponent : MonoBehaviour
|
||||||
|
{
|
||||||
|
public string Parent;
|
||||||
|
public string Direction ;
|
||||||
|
public Vector3 BoundsCenter ; // 新增的属性,用于保存边界中心
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a7e37b9be6900a94c94a13b57e6f264b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,40 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class RevealName : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 提示
|
||||||
|
/// </summary>
|
||||||
|
public Transform Tips;
|
||||||
|
/// <summary>
|
||||||
|
/// 提示文本
|
||||||
|
/// </summary>
|
||||||
|
public Text tiptext;
|
||||||
|
/// <summary>
|
||||||
|
/// 接收初始化位置
|
||||||
|
/// </summary>
|
||||||
|
public Vector3 Point;
|
||||||
|
public void OnPointerEnter(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
tiptext.text = transform.name;
|
||||||
|
Tips.position = eventData.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPointerExit(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
tiptext.text = "";
|
||||||
|
Tips.position = Point;
|
||||||
|
}
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
Point = Tips.position;
|
||||||
|
}
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 673ebf9de600cee40852d73e281d7d35
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -308,31 +308,31 @@ namespace DefaultNamespace
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Cigarette_Box_Type { get; set; }
|
public string TaskNumber { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Current_Layer { get; set; }
|
public string BoxType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string LowerBoxNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string CurrentLayer { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string FaultFree { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Ascent { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Descent { get; set; }
|
public string Descent { get; set; }
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Lower_Box_Number { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Rise { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Task_Number { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Trouble_Free { get; set; }
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拆码垛机
|
/// 拆码垛机
|
||||||
|
@ -347,15 +347,19 @@ namespace DefaultNamespace
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Task_Number { get; set; }
|
public string TaskNumber { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Number_of_cigarette_boxes { get; set; }
|
public string boxesNumber { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Trouble_free { get; set; }
|
public string FaultFree { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Ascent { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -363,7 +367,23 @@ namespace DefaultNamespace
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Rise { get; set; }
|
public string ExtensingFork { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string RetractingFork { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string UpperInPlace { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string MiddleInPlace { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string DownInPlace { get; set; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 输送机设备
|
/// 输送机设备
|
||||||
|
@ -374,63 +394,63 @@ namespace DefaultNamespace
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Id { get; set; }
|
public string Id;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ForwardRotation { get; set; }
|
public string TaskNumber;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LowerBoxNumber { get; set; }
|
public string LowerBoxNumber;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string NumberOfCigaretteBoxes { get; set; }
|
public string LowerBoxTobaccoWeight;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OccupiedSign { get; set; }
|
public string UpperBoxNumber;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Reverse { get; set; }
|
public string UpperBoxTobaccoWeight;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RFIDReadFailure { get; set; }
|
public string BoxesNumber;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RFIDWriteFailure { get; set; }
|
public string OccupiedMark;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TaskNumber { get; set; }
|
public string FaultFree;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TroubleFree { get; set; }
|
public string ForwardRotation;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UpperBoxNumber { get; set; }
|
public string ReverseRotation;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string WCSRequestTimeoutFault { get; set; }
|
public string RFIDReadFault;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string WCSTaskExceptionFailure { get; set; }
|
public string RFIDWriteFailure;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string WeightTobaccoLower { get; set; }
|
public string WCSTaskAbnormalFailure;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string WeightTobaccoUpper { get; set; }
|
public string WCSApplicationTimeoutFailure;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 小车设备
|
/// 小车设备
|
||||||
|
@ -445,7 +465,7 @@ namespace DefaultNamespace
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CarState_BoxCode { get; set; }
|
public string JobState_BoxCode { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -469,6 +489,14 @@ namespace DefaultNamespace
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
public string JobState_CarPlt { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string CarState_Err01 { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string CarState_Err02 { get; set; }
|
public string CarState_Err02 { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -482,14 +510,6 @@ namespace DefaultNamespace
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CarState_Err05 { get; set; }
|
public string CarState_Err05 { get; set; }
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string CarState_Err01 { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string JobState_CarPlt { get; set; }
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询式落地机
|
/// 查询式落地机
|
||||||
|
@ -1681,6 +1701,7 @@ namespace DefaultNamespace
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string palletType;
|
public string palletType;
|
||||||
|
public string rfIdCode;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Testone : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Animator Animation;
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown(KeyCode.A))
|
||||||
|
{
|
||||||
|
//Animation.speed = 1;
|
||||||
|
Animation.SetBool("²ð·Ö", true);
|
||||||
|
}
|
||||||
|
if (Input.GetKeyDown(KeyCode.B))
|
||||||
|
{
|
||||||
|
Animation.speed = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IEnumerator Test()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0997e6b650d573d4aad94c7dfbef37bc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,23 +1,285 @@
|
||||||
|
using DefaultNamespace;
|
||||||
|
using DG.Tweening;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.ConstrainedExecution;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using static InterfaceManager;
|
||||||
|
|
||||||
public class Carinformation : MonoBehaviour
|
public class Carinformation : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 小车ID
|
||||||
|
/// </summary>
|
||||||
public string ID;
|
public string ID;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取mqtt数据对应的箱子id
|
/// 小车名字
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BoxCode;
|
public string Name;
|
||||||
|
/// <summary>
|
||||||
|
/// 需要渲染的箱子0
|
||||||
|
/// </summary>
|
||||||
|
public GameObject BoxID;
|
||||||
|
/// <summary>
|
||||||
|
/// 普通实箱
|
||||||
|
/// </summary>
|
||||||
|
public Material Commonfruitbox;
|
||||||
|
/// <summary>
|
||||||
|
/// 普通空箱
|
||||||
|
/// </summary>
|
||||||
|
public Material Normalairbox;
|
||||||
|
/// <summary>
|
||||||
|
/// 特殊实箱
|
||||||
|
/// </summary>
|
||||||
|
public Material Specialkernelbox;
|
||||||
|
/// <summary>
|
||||||
|
/// 特殊空箱
|
||||||
|
/// </summary>
|
||||||
|
public Material Specialbox;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否初始化
|
||||||
|
/// </summary>
|
||||||
|
private bool isInit = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 小车速度
|
||||||
|
/// </summary>
|
||||||
|
public float Speed = 3.5f;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
}
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 点位,初始发,是否装箱子,是否卸箱子
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="carequipment"></param>
|
||||||
|
public void Setbox(Carequipment carequipment)
|
||||||
|
{
|
||||||
|
string pointName = carequipment.CarState_Car_Row + "-" + carequipment.CarState_Car_Column + "-" + carequipment.CarState_Car_Layer;
|
||||||
|
if (MqttManager.Instance.GetTransformByName(pointName))
|
||||||
|
{
|
||||||
|
Transform currentPoint = MqttManager.Instance.GetTransformByName(pointName);
|
||||||
|
if (currentPoint && !isInit)
|
||||||
|
{
|
||||||
|
SetPoint(currentPoint);
|
||||||
|
if (carequipment.CarState_CarPlt == "2" && currentPoint.childCount == 0 && transform.childCount == 0 && carequipment.JobState_BoxCode != "0")
|
||||||
|
{
|
||||||
|
Initbox(carequipment.JobState_BoxCode, carequipment.CarState_Car_Layer);
|
||||||
|
}
|
||||||
|
isInit = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Designateddisplacement(currentPoint.position, Speed);
|
||||||
|
}
|
||||||
|
if (carequipment.CarState_CarPlt == "2")
|
||||||
|
{
|
||||||
|
Encasement(currentPoint);
|
||||||
|
}
|
||||||
|
else if (carequipment.CarState_CarPlt == "1")
|
||||||
|
{
|
||||||
|
UnloadBox(currentPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 小车移动动画
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dis"></param>
|
||||||
|
/// <param name="speed"></param>
|
||||||
|
public void Designateddisplacement(Vector3 dis, float speed)
|
||||||
|
{
|
||||||
|
Debug.Log("小车运动了");
|
||||||
|
float times = Vector3.Distance(transform.position, dis) / speed;
|
||||||
|
transform.DOMove(dis, times).SetEase(Ease.InOutQuad);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化赋值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point"></param>
|
||||||
|
public void SetPoint(Transform point)
|
||||||
|
{
|
||||||
|
transform.position = point.position;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化箱子把箱子放到小车上并判断生成箱子颜色
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="boxdata"></param>
|
||||||
|
public void Initbox(string boxdata, string layer)
|
||||||
|
{
|
||||||
|
string url = Initializes + boxdata;
|
||||||
|
Debug.Log("箱子ID" + boxdata);
|
||||||
|
Debug.Log("箱子请求路径" + url);
|
||||||
|
StartCoroutine(Getstring(url, (data) =>
|
||||||
|
{
|
||||||
|
Debug.Log("初始发对应的箱子数据" + data);
|
||||||
|
ShelfBoxModel shelfBoxModel = JsonUtility.FromJson<ShelfBoxModel>(data);
|
||||||
|
if (shelfBoxModel != null && BoxID)
|
||||||
|
{
|
||||||
|
GameObject box = Instantiate(BoxID, transform);
|
||||||
|
Boxinformation boxinformation = box.AddComponent<Boxinformation>();
|
||||||
|
if (boxinformation != null)
|
||||||
|
{
|
||||||
|
boxinformation.ID = shelfBoxModel.result[0].id;
|
||||||
|
boxinformation.type = shelfBoxModel.result[0].type;
|
||||||
|
boxinformation.locationId = shelfBoxModel.result[0].locationId;
|
||||||
|
boxinformation.description = shelfBoxModel.result[0].description;
|
||||||
|
boxinformation.locationState = shelfBoxModel.result[0].locationState;
|
||||||
|
boxinformation.storageState = shelfBoxModel.result[0].storageState;
|
||||||
|
boxinformation.layer = shelfBoxModel.result[0].layer;
|
||||||
|
boxinformation.row = shelfBoxModel.result[0].row;
|
||||||
|
boxinformation.column = shelfBoxModel.result[0].column;
|
||||||
|
boxinformation.specialFlag = shelfBoxModel.result[0].specialFlag;
|
||||||
|
boxinformation.palletNum = shelfBoxModel.result[0].palletNum;
|
||||||
|
boxinformation.itemType = shelfBoxModel.result[0].itemType;
|
||||||
|
boxinformation.isSpecial = shelfBoxModel.result[0].isSpecial;
|
||||||
|
switch (shelfBoxModel.result[0].isSpecial)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if (shelfBoxModel.result[0].itemType == "EmptyBox")
|
||||||
|
{
|
||||||
|
Renderer renderer = box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer1 = box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer != null)
|
||||||
|
{
|
||||||
|
renderer.material = Specialbox;
|
||||||
|
}
|
||||||
|
if (renderer1 != null)
|
||||||
|
{
|
||||||
|
renderer1.material = Specialbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Renderer renderer2 = box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer3 = box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer2 != null)
|
||||||
|
{
|
||||||
|
renderer2.material = Specialkernelbox;
|
||||||
|
}
|
||||||
|
if (renderer3 != null)
|
||||||
|
{
|
||||||
|
renderer3.material = Specialkernelbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (shelfBoxModel.result[0].itemType == "EmptyBox")
|
||||||
|
{
|
||||||
|
Renderer renderer = box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer1 = box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer != null)
|
||||||
|
{
|
||||||
|
renderer.material = Normalairbox;
|
||||||
|
}
|
||||||
|
if (renderer1 != null)
|
||||||
|
{
|
||||||
|
renderer1.material = Normalairbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Renderer renderer2 = box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer3 = box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer2 != null)
|
||||||
|
{
|
||||||
|
renderer2.material = Commonfruitbox;
|
||||||
|
}
|
||||||
|
if (renderer3 != null)
|
||||||
|
{
|
||||||
|
renderer3.material = Commonfruitbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Collider triggerCollider = GetComponent<Collider>();
|
||||||
|
// 确保触发器物体有碰撞体
|
||||||
|
if (triggerCollider != null)
|
||||||
|
{
|
||||||
|
// 计算触发器物体顶部的世界坐标
|
||||||
|
Vector3 triggerPosition = triggerCollider.bounds.center;
|
||||||
|
Vector3 triggerTop = triggerPosition + Vector3.up * (triggerCollider.bounds.extents.y);
|
||||||
|
|
||||||
|
// 设置物体的位置
|
||||||
|
box.gameObject.transform.localEulerAngles = new Vector3(90, 0, 0);
|
||||||
|
box.gameObject.transform.position = triggerTop;
|
||||||
|
box.gameObject.transform.SetParent(transform, false);
|
||||||
|
|
||||||
|
Debug.Log("箱子位置初始化");
|
||||||
|
MqttManager.Instance.Deletebox(boxinformation.ID, boxinformation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("触发器没有碰撞体");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (layer.Equals(1))
|
||||||
|
{
|
||||||
|
GameObject childbox = box.transform.GetChild(0).gameObject;
|
||||||
|
MqttManager.Instance.firstbox.Add(childbox);
|
||||||
|
MqttManager.Instance.firstbox.Add(box);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameObject childbox = box.transform.GetChild(0).gameObject;
|
||||||
|
MqttManager.Instance.secondbox.Add(childbox);
|
||||||
|
MqttManager.Instance.secondbox.Add(box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 执行上箱
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point"></param>
|
||||||
|
public void Encasement(Transform point)
|
||||||
|
{
|
||||||
|
if (point.childCount > 0)
|
||||||
|
{
|
||||||
|
Collider collider = point.GetChild(0).gameObject.GetComponent<Collider>();
|
||||||
|
if (collider != null)
|
||||||
|
{
|
||||||
|
collider.isTrigger = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 执行卸箱
|
||||||
|
/// </summary>
|
||||||
|
public void UnloadBox(Transform point)
|
||||||
|
{
|
||||||
|
if (transform.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = transform.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
box.gameObject.transform.DOMoveY(box.gameObject.transform.position.y + 0.2f, 0.2f).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
if (box.GetComponent<Collider>())
|
||||||
|
{
|
||||||
|
Collider collider = box.GetComponent<Collider>();
|
||||||
|
if (collider != null)
|
||||||
|
{
|
||||||
|
collider.isTrigger = false;
|
||||||
|
box.gameObject.transform.SetParent(null);
|
||||||
|
}
|
||||||
|
box.gameObject.transform.DOMoveY(box.gameObject.transform.position.y - 0.62f, 0.6f).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
if (point)
|
||||||
|
{
|
||||||
|
box.gameObject.transform.SetParent(point);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
|
using DefaultNamespace;
|
||||||
|
using DG.Tweening;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class Consentmark : MonoBehaviour
|
public class Consentmark : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 所有设备id
|
||||||
|
/// </summary>
|
||||||
public string ID;
|
public string ID;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
using DefaultNamespace;
|
||||||
|
using DG.Tweening;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Unity.VisualScripting;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Conveyordata : MonoBehaviour
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 输送机ID
|
||||||
|
/// </summary>
|
||||||
|
public string ID;
|
||||||
|
/// <summary>
|
||||||
|
/// 正转位置
|
||||||
|
/// </summary>
|
||||||
|
[Header("正传需要位移的位置")]
|
||||||
|
public Transform Pointforword;
|
||||||
|
/// <summary>
|
||||||
|
/// 反转位置
|
||||||
|
/// </summary>
|
||||||
|
[Header("正传判断箱子位置")]
|
||||||
|
public Transform Pointreversal;
|
||||||
|
/// <summary>
|
||||||
|
/// 提升机反转位置
|
||||||
|
/// </summary>
|
||||||
|
[Header("一层反转提升机位置")]
|
||||||
|
public Transform Liftreversal;
|
||||||
|
[Header("二层反转提升机位置")]
|
||||||
|
public Transform Liftreversal2;
|
||||||
|
[Header("反转判断箱子点位")]
|
||||||
|
public Transform Antipoint;
|
||||||
|
[Header("反转需要位移的位置")]
|
||||||
|
public Transform Antipoint2;
|
||||||
|
/// <summary>
|
||||||
|
/// 运动的速度
|
||||||
|
/// </summary>
|
||||||
|
public float Speed = 3.5f;
|
||||||
|
public void ConveyorData(Convoyorequipment convoyorequipment)
|
||||||
|
{
|
||||||
|
if (convoyorequipment.TaskNumber != "0")
|
||||||
|
{
|
||||||
|
if (convoyorequipment.ForwardRotation == "True")
|
||||||
|
{
|
||||||
|
Debug.Log("正转");
|
||||||
|
Forwardposition();
|
||||||
|
}
|
||||||
|
if (convoyorequipment.ReverseRotation == "True")
|
||||||
|
{
|
||||||
|
Debug.Log("反转");
|
||||||
|
Reverseposition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 正传运动
|
||||||
|
/// </summary>
|
||||||
|
public void Forwardposition()
|
||||||
|
{
|
||||||
|
if (Pointreversal.childCount > 0 && Pointreversal)
|
||||||
|
{
|
||||||
|
GameObject box = Pointreversal.transform.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
box.transform.DOMove(Pointforword.position, (Vector3.Distance(box.transform.position, Pointforword.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Pointforword);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 反转运动
|
||||||
|
/// </summary>
|
||||||
|
public void Reverseposition()
|
||||||
|
{
|
||||||
|
if (GetComponent<Hoistmovement>())
|
||||||
|
{
|
||||||
|
Hoistmovement hoistmovement = GetComponent<Hoistmovement>();
|
||||||
|
Debug.Log("一层");
|
||||||
|
if (hoistmovement.Downpoint.childCount > 0 && Liftreversal)
|
||||||
|
{
|
||||||
|
Debug.Log("进来了");
|
||||||
|
GameObject box = hoistmovement.Downpoint.transform.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
Debug.Log("反转一层");
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
box.transform.DOMove(Liftreversal.position, (Vector3.Distance(box.transform.position, Liftreversal.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Liftreversal);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (hoistmovement.UPpoint.childCount > 0 && Liftreversal2)
|
||||||
|
{
|
||||||
|
Debug.Log("进来了");
|
||||||
|
GameObject box = hoistmovement.UPpoint.transform.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
Debug.Log("反转二层");
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
box.transform.DOMove(Liftreversal2.position, (Vector3.Distance(box.transform.position, Liftreversal2.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Liftreversal2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Antipoint)
|
||||||
|
{
|
||||||
|
if (Antipoint.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = Antipoint.transform.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
box.transform.DOMove(Antipoint2.position, (Vector3.Distance(box.transform.position, Antipoint2.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
Debug.Log("正常反转");
|
||||||
|
box.transform.SetParent(Antipoint2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("箱子等于空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("不走反转");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("啥也不是");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b71d8d94874314848b91bed1b0c0034d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -101,10 +101,10 @@ public class Enteringreservoirarea : MonoBehaviour
|
||||||
/// <param name="other"></param>
|
/// <param name="other"></param>
|
||||||
private async void OnTriggerEnter(Collider other)
|
private async void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
if (other.gameObject.CompareTag("Box"))
|
//if (other.gameObject.CompareTag("Box"))
|
||||||
{
|
//{
|
||||||
await Makeprogress(other.gameObject, Uptrans);
|
// await Makeprogress(other.gameObject, Uptrans);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
@ -5,6 +5,7 @@ using static InterfaceManager;
|
||||||
using DefaultNamespace;
|
using DefaultNamespace;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using cakeslice;
|
using cakeslice;
|
||||||
|
using System.Runtime.ConstrainedExecution;
|
||||||
public class Fetchbox : MonoBehaviour
|
public class Fetchbox : MonoBehaviour
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -20,10 +21,21 @@ public class Fetchbox : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ShelfBoxModel shelfBoxModel = new ShelfBoxModel();
|
public ShelfBoxModel shelfBoxModel = new ShelfBoxModel();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 每个箱子的信息
|
/// 普通实箱
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Boxinformation> boxinformationList = new List<Boxinformation>();
|
public Material Commonfruitbox;
|
||||||
|
/// <summary>
|
||||||
|
/// 普通空箱
|
||||||
|
/// </summary>
|
||||||
|
public Material Normalairbox;
|
||||||
|
/// <summary>
|
||||||
|
/// 特殊实箱
|
||||||
|
/// </summary>
|
||||||
|
public Material Specialkernelbox;
|
||||||
|
/// <summary>
|
||||||
|
/// 特殊空箱
|
||||||
|
/// </summary>
|
||||||
|
public Material Specialbox;
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
url += Boxface;
|
url += Boxface;
|
||||||
|
@ -31,8 +43,28 @@ public class Fetchbox : MonoBehaviour
|
||||||
{
|
{
|
||||||
//Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Boxdata(data);
|
Boxdata(data);
|
||||||
Debug.Log("调用l");
|
//Debug.Log("调用l");
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
//if (Input.GetMouseButtonDown(2))
|
||||||
|
//{
|
||||||
|
// if (MqttManager.Instance.boxinformationList.Count > 0)
|
||||||
|
// {
|
||||||
|
// for (int i = 0; i < MqttManager.Instance.boxinformationList.Count; i++)
|
||||||
|
// {
|
||||||
|
// Debug.Log("劲来了");
|
||||||
|
// if (MqttManager.Instance.boxinformationList[i].ID == "XSCS_01_010100100400100")
|
||||||
|
// {
|
||||||
|
// Debug.Log("删除");
|
||||||
|
// Destroy(MqttManager.Instance.boxinformationList[i].gameObject);
|
||||||
|
// MqttManager.Instance.boxinformationList.Remove(MqttManager.Instance.boxinformationList[i]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ½âÎöÏä×ÓµÄÊý¾Ý
|
/// ½âÎöÏä×ÓµÄÊý¾Ý
|
||||||
|
@ -57,6 +89,7 @@ public class Fetchbox : MonoBehaviour
|
||||||
GameObject parentObject = GameObject.Find(boxname);
|
GameObject parentObject = GameObject.Find(boxname);
|
||||||
if (parentObject)
|
if (parentObject)
|
||||||
{
|
{
|
||||||
|
//MqttManager.Instance.boxinpots.Add(boxname);
|
||||||
Box.transform.SetParent(parentObject.transform, false);
|
Box.transform.SetParent(parentObject.transform, false);
|
||||||
boxinformation.ID = shelfBoxModel.result[i].id;
|
boxinformation.ID = shelfBoxModel.result[i].id;
|
||||||
boxinformation.type = shelfBoxModel.result[i].type;
|
boxinformation.type = shelfBoxModel.result[i].type;
|
||||||
|
@ -71,8 +104,68 @@ public class Fetchbox : MonoBehaviour
|
||||||
boxinformation.palletNum = shelfBoxModel.result[i].palletNum;
|
boxinformation.palletNum = shelfBoxModel.result[i].palletNum;
|
||||||
boxinformation.itemType = shelfBoxModel.result[i].itemType;
|
boxinformation.itemType = shelfBoxModel.result[i].itemType;
|
||||||
boxinformation.isSpecial = shelfBoxModel.result[i].isSpecial;
|
boxinformation.isSpecial = shelfBoxModel.result[i].isSpecial;
|
||||||
//if (shelfBoxModel.result[i].
|
switch (shelfBoxModel.result[i].isSpecial)
|
||||||
boxinformationList.Add(boxinformation);
|
{
|
||||||
|
case 0:
|
||||||
|
if (shelfBoxModel.result[i].itemType == "EmptyBox")
|
||||||
|
{
|
||||||
|
Renderer renderer = Box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer1 = Box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer != null)
|
||||||
|
{
|
||||||
|
renderer.material = Specialbox;
|
||||||
|
}
|
||||||
|
if (renderer1 != null)
|
||||||
|
{
|
||||||
|
renderer1.material = Specialbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Renderer renderer2 = Box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer3 = Box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer2 != null)
|
||||||
|
{
|
||||||
|
renderer2.material = Specialkernelbox;
|
||||||
|
}
|
||||||
|
if (renderer3 != null)
|
||||||
|
{
|
||||||
|
renderer3.material = Specialkernelbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (shelfBoxModel.result[i].itemType == "EmptyBox")
|
||||||
|
{
|
||||||
|
Renderer renderer = Box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer1 = Box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer != null)
|
||||||
|
{
|
||||||
|
renderer.material = Normalairbox;
|
||||||
|
}
|
||||||
|
if (renderer1 != null)
|
||||||
|
{
|
||||||
|
renderer1.material = Normalairbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Renderer renderer2 = Box.GetComponent<Renderer>();
|
||||||
|
Renderer renderer3 = Box.transform.GetChild(0).GetComponent<Renderer>();
|
||||||
|
if (renderer2 != null)
|
||||||
|
{
|
||||||
|
renderer2.material = Commonfruitbox;
|
||||||
|
}
|
||||||
|
if (renderer3 != null)
|
||||||
|
{
|
||||||
|
renderer3.material = Commonfruitbox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MqttManager.Instance.boxinformationList.Add(boxinformation);
|
||||||
if (shelfBoxModel.result[i].layer.Equals(1))
|
if (shelfBoxModel.result[i].layer.Equals(1))
|
||||||
{
|
{
|
||||||
GameObject childbox = Box.transform.GetChild(0).gameObject;
|
GameObject childbox = Box.transform.GetChild(0).gameObject;
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
using DefaultNamespace;
|
||||||
|
using DG.Tweening;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Hoistmovement : MonoBehaviour
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 提升机ID
|
||||||
|
/// </summary>
|
||||||
|
public string ID;
|
||||||
|
/// <summary>
|
||||||
|
/// 一层位置
|
||||||
|
/// </summary>
|
||||||
|
public Transform Downpoint;
|
||||||
|
/// <summary>
|
||||||
|
/// 二层位置
|
||||||
|
/// </summary>
|
||||||
|
public Transform UPpoint;
|
||||||
|
/// <summary>
|
||||||
|
/// 运动的速度
|
||||||
|
/// </summary>
|
||||||
|
public float Speed = 3.5f;
|
||||||
|
public void Hoister(Elvequipment elvequipment)
|
||||||
|
{
|
||||||
|
if (elvequipment.CurrentLayer == "1")
|
||||||
|
{
|
||||||
|
Debug.Log("一层");
|
||||||
|
Alayer();
|
||||||
|
}
|
||||||
|
else if(elvequipment.CurrentLayer == "2")
|
||||||
|
{
|
||||||
|
Debug.Log("二层");
|
||||||
|
Layertwo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 下降到一层
|
||||||
|
/// </summary>
|
||||||
|
public void Alayer()
|
||||||
|
{
|
||||||
|
if (UPpoint.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = UPpoint.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(transform);
|
||||||
|
transform.DOMove(Downpoint.position, (Vector3.Distance(transform.position, Downpoint.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Downpoint);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Designateddisplacement(Downpoint.position,Speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 上升二层
|
||||||
|
/// </summary>
|
||||||
|
public void Layertwo()
|
||||||
|
{
|
||||||
|
if(Downpoint.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = Downpoint.GetChild(0).gameObject;
|
||||||
|
if(box != null)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(transform);
|
||||||
|
transform.DOMove(UPpoint.position, (Vector3.Distance(transform.position, UPpoint.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(UPpoint);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Designateddisplacement(UPpoint.position, Speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 移动方法
|
||||||
|
/// </summary>
|
||||||
|
public void Designateddisplacement(Vector3 dis, float speed)
|
||||||
|
{
|
||||||
|
Debug.Log("提升机移动");
|
||||||
|
float times = Vector3.Distance(transform.position, dis) / speed;
|
||||||
|
transform.DOMove(dis, times).SetEase(Ease.InOutQuad);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d8788dec273d85347bf19896cf19622e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -65,7 +65,7 @@ public class Interaction : MonoBehaviour
|
||||||
{
|
{
|
||||||
boxbtn.onClick.AddListener(Tests);
|
boxbtn.onClick.AddListener(Tests);
|
||||||
}
|
}
|
||||||
private void Tests()
|
public void Tests()
|
||||||
{
|
{
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ public class Interaction : MonoBehaviour
|
||||||
//}
|
//}
|
||||||
//Debug.Log(boxinformation.locationId);
|
//Debug.Log(boxinformation.locationId);
|
||||||
string url = Boxinformationface + boxinformation.locationId;
|
string url = Boxinformationface + boxinformation.locationId;
|
||||||
Debug.Log(url);
|
//Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
Debug.Log(data);
|
||||||
|
@ -156,11 +156,13 @@ public class Interaction : MonoBehaviour
|
||||||
{
|
{
|
||||||
if (cigaretteinformation.result[i].lineNum.Equals(1))
|
if (cigaretteinformation.result[i].lineNum.Equals(1))
|
||||||
{
|
{
|
||||||
UIBoxdatapanel.Getdata(cigaretteinformation.result[i].itemDesc, cigaretteinformation.result[i].batch, cigaretteinformation.result[i].palletNum, cigaretteinformation.result[i].weight);
|
UIBoxdatapanel.GetDragdown(cigaretteinformation.result[i].rfIdCode, cigaretteinformation.result[i].weight);
|
||||||
|
|
||||||
};
|
};
|
||||||
if (cigaretteinformation.result[i].lineNum.Equals(2))
|
if (cigaretteinformation.result[i].lineNum.Equals(2))
|
||||||
{
|
{
|
||||||
UIBoxdatapanel.GetDragdown(cigaretteinformation.result[i].palletNum, cigaretteinformation.result[i].weight);
|
|
||||||
|
UIBoxdatapanel.Getdata(cigaretteinformation.result[i].itemDesc, cigaretteinformation.result[i].batch, cigaretteinformation.result[i].palletNum, cigaretteinformation.result[i].weight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIBoxdatapanel.Getoff(() =>
|
UIBoxdatapanel.Getoff(() =>
|
||||||
|
@ -174,14 +176,14 @@ public class Interaction : MonoBehaviour
|
||||||
}
|
}
|
||||||
if (hit.collider.CompareTag("Hoister"))
|
if (hit.collider.CompareTag("Hoister"))
|
||||||
{
|
{
|
||||||
Debug.Log(gameObject.name);
|
//Debug.Log(gameObject.name);
|
||||||
Consentmark hoistinformation = hit.collider.gameObject.GetComponent<Consentmark>();
|
Consentmark hoistinformation = hit.collider.gameObject.GetComponent<Consentmark>();
|
||||||
// Debug.Log(hoistinformation.ID);
|
// Debug.Log(hoistinformation.ID);
|
||||||
string url = Hoisinterface + hoistinformation.ID;
|
string url = Hoisinterface + hoistinformation.ID;
|
||||||
// Debug.Log(url);
|
// Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Elevatorpopup elevatdata = JsonUtility.FromJson<Elevatorpopup>(data);
|
Elevatorpopup elevatdata = JsonUtility.FromJson<Elevatorpopup>(data);
|
||||||
// Debug.Log(elevatdata.result.lowerDecelerationInspection);
|
// Debug.Log(elevatdata.result.lowerDecelerationInspection);
|
||||||
UIHoister.Gethoister(elevatdata.result.taskNumber, elevatdata.result.currentLayer, elevatdata.result.targetLayer, elevatdata.result.startingLayer,
|
UIHoister.Gethoister(elevatdata.result.taskNumber, elevatdata.result.currentLayer, elevatdata.result.targetLayer, elevatdata.result.startingLayer,
|
||||||
|
@ -198,14 +200,14 @@ public class Interaction : MonoBehaviour
|
||||||
}
|
}
|
||||||
if (hit.collider.CompareTag("Palletizer"))
|
if (hit.collider.CompareTag("Palletizer"))
|
||||||
{
|
{
|
||||||
Debug.Log(gameObject.name);
|
//Debug.Log(gameObject.name);
|
||||||
Consentmark palletizerparameters = hit.collider.gameObject.GetComponent<Consentmark>();
|
Consentmark palletizerparameters = hit.collider.gameObject.GetComponent<Consentmark>();
|
||||||
// Debug.Log(palletizerparameters.ID);
|
// Debug.Log(palletizerparameters.ID);
|
||||||
string url = Palletizerface + palletizerparameters.ID;
|
string url = Palletizerface + palletizerparameters.ID;
|
||||||
//Debug.Log(url);
|
//Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
//Debug.Log(data);
|
||||||
PalletizerMessage palletizer = JsonUtility.FromJson<PalletizerMessage>(data);
|
PalletizerMessage palletizer = JsonUtility.FromJson<PalletizerMessage>(data);
|
||||||
// Debug.Log(palletizer.result.id);
|
// Debug.Log(palletizer.result.id);
|
||||||
UIPalletizer.Getpalletizer(palletizer.result.boxesNumber, palletizer.result.leftExtensionForkPositionInspection, palletizer.result.rightExtensionForkPositionInspection,
|
UIPalletizer.Getpalletizer(palletizer.result.boxesNumber, palletizer.result.leftExtensionForkPositionInspection, palletizer.result.rightExtensionForkPositionInspection,
|
||||||
|
@ -222,14 +224,14 @@ public class Interaction : MonoBehaviour
|
||||||
}
|
}
|
||||||
if (hit.collider.CompareTag("Battery"))
|
if (hit.collider.CompareTag("Battery"))
|
||||||
{
|
{
|
||||||
Debug.Log(gameObject.name);
|
//Debug.Log(gameObject.name);
|
||||||
Consentmark batterychanger = hit.collider.gameObject.GetComponent<Consentmark>();
|
Consentmark batterychanger = hit.collider.gameObject.GetComponent<Consentmark>();
|
||||||
//Debug.Log(batterychanger.ID);
|
//Debug.Log(batterychanger.ID);
|
||||||
string url = Batteryface + batterychanger.ID;
|
string url = Batteryface + batterychanger.ID;
|
||||||
// Debug.Log(url);
|
// Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Batterydata batterydata = JsonUtility.FromJson<Batterydata>(data);
|
Batterydata batterydata = JsonUtility.FromJson<Batterydata>(data);
|
||||||
Debug.Log(batterydata.result.id);
|
Debug.Log(batterydata.result.id);
|
||||||
UIReplacebattery.Getbattery(batterydata.result.taskNumber, batterydata.result.batteryStatus0, batterydata.result.batteryStatus1, batterydata.result.batteryStatus2, batterydata.result.batteryStatus3,
|
UIReplacebattery.Getbattery(batterydata.result.taskNumber, batterydata.result.batteryStatus0, batterydata.result.batteryStatus1, batterydata.result.batteryStatus2, batterydata.result.batteryStatus3,
|
||||||
|
@ -244,14 +246,14 @@ public class Interaction : MonoBehaviour
|
||||||
}
|
}
|
||||||
if (hit.collider.CompareTag("Outofthe"))
|
if (hit.collider.CompareTag("Outofthe"))
|
||||||
{
|
{
|
||||||
Debug.Log(gameObject.name);
|
//Debug.Log(gameObject.name);
|
||||||
Consentmark outofthe = hit.collider.GetComponent<Consentmark>();
|
Consentmark outofthe = hit.collider.GetComponent<Consentmark>();
|
||||||
// Debug.Log(outofthe.ID);
|
// Debug.Log(outofthe.ID);
|
||||||
string url = Outoftheface + outofthe.ID;
|
string url = Outoftheface + outofthe.ID;
|
||||||
// Debug.Log(url);
|
// Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Conveyors outofthe = JsonUtility.FromJson<Conveyors>(data);
|
Conveyors outofthe = JsonUtility.FromJson<Conveyors>(data);
|
||||||
Debug.Log(outofthe.result.id);
|
Debug.Log(outofthe.result.id);
|
||||||
UIConveyorpanel.Getconvey(outofthe.result.taskNumber, outofthe.result.upperBoxNumber, outofthe.result.startingAddress, outofthe.result.upperBoxTobaccoWeight, outofthe.result.destinationAddress, outofthe.result.lowerBoxNumber,
|
UIConveyorpanel.Getconvey(outofthe.result.taskNumber, outofthe.result.upperBoxNumber, outofthe.result.startingAddress, outofthe.result.upperBoxTobaccoWeight, outofthe.result.destinationAddress, outofthe.result.lowerBoxNumber,
|
||||||
|
@ -266,14 +268,14 @@ public class Interaction : MonoBehaviour
|
||||||
}
|
}
|
||||||
if (hit.collider.CompareTag("Intothe"))
|
if (hit.collider.CompareTag("Intothe"))
|
||||||
{
|
{
|
||||||
Debug.Log(gameObject.name);
|
//Debug.Log(gameObject.name);
|
||||||
Consentmark intothes = hit.collider.GetComponent<Consentmark>();
|
Consentmark intothes = hit.collider.GetComponent<Consentmark>();
|
||||||
// Debug.Log(intothes.ID);
|
// Debug.Log(intothes.ID);
|
||||||
string url = Intotheface + intothes.ID;
|
string url = Intotheface + intothes.ID;
|
||||||
// Debug.Log(url);
|
// Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Conveyors intothe = JsonUtility.FromJson<Conveyors>(data);
|
Conveyors intothe = JsonUtility.FromJson<Conveyors>(data);
|
||||||
//Debug.Log(intothe.result.id);
|
//Debug.Log(intothe.result.id);
|
||||||
UIConveyorpanel.Getconvey(intothe.result.taskNumber, intothe.result.upperBoxNumber, intothe.result.startingAddress, intothe.result.upperBoxTobaccoWeight, intothe.result.destinationAddress, intothe.result.lowerBoxNumber,
|
UIConveyorpanel.Getconvey(intothe.result.taskNumber, intothe.result.upperBoxNumber, intothe.result.startingAddress, intothe.result.upperBoxTobaccoWeight, intothe.result.destinationAddress, intothe.result.lowerBoxNumber,
|
||||||
|
@ -288,14 +290,14 @@ public class Interaction : MonoBehaviour
|
||||||
}
|
}
|
||||||
if (hit.collider.CompareTag("floortype"))
|
if (hit.collider.CompareTag("floortype"))
|
||||||
{
|
{
|
||||||
Debug.Log(gameObject.name);
|
//Debug.Log(gameObject.name);
|
||||||
Consentmark floor = hit.collider.gameObject.GetComponent<Consentmark>();
|
Consentmark floor = hit.collider.gameObject.GetComponent<Consentmark>();
|
||||||
//Debug.Log(floor.ID);
|
//Debug.Log(floor.ID);
|
||||||
string url = Floorface + floor.ID;
|
string url = Floorface + floor.ID;
|
||||||
//Debug.Log(url);
|
//Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Feequipments feequipments = JsonUtility.FromJson<Feequipments>(data);
|
Feequipments feequipments = JsonUtility.FromJson<Feequipments>(data);
|
||||||
//Debug.Log(feequipments.result.id);
|
//Debug.Log(feequipments.result.id);
|
||||||
UIFloorelevator.Getfloorele(feequipments.result.deviceStatus, feequipments.result.upperInPlace, feequipments.result.ascent, feequipments.result.upperLimitInspection,
|
UIFloorelevator.Getfloorele(feequipments.result.deviceStatus, feequipments.result.upperInPlace, feequipments.result.ascent, feequipments.result.upperLimitInspection,
|
||||||
|
@ -311,14 +313,14 @@ public class Interaction : MonoBehaviour
|
||||||
}
|
}
|
||||||
if (hit.collider.CompareTag("decap"))
|
if (hit.collider.CompareTag("decap"))
|
||||||
{
|
{
|
||||||
Debug.Log(gameObject.name);
|
//Debug.Log(gameObject.name);
|
||||||
Consentmark decaps = hit.collider.gameObject.GetComponent<Consentmark>();
|
Consentmark decaps = hit.collider.gameObject.GetComponent<Consentmark>();
|
||||||
//Debug.Log(decaps.ID);
|
//Debug.Log(decaps.ID);
|
||||||
string url = Decapface + decaps.ID;
|
string url = Decapface + decaps.ID;
|
||||||
Debug.Log(url);
|
//Debug.Log(url);
|
||||||
StartCoroutine(Post1(url, (data) =>
|
StartCoroutine(Post1(url, (data) =>
|
||||||
{
|
{
|
||||||
Debug.Log(data);
|
//Debug.Log(data);
|
||||||
Decappingmachine decappingmachine = JsonUtility.FromJson<Decappingmachine>(data);
|
Decappingmachine decappingmachine = JsonUtility.FromJson<Decappingmachine>(data);
|
||||||
// Debug.Log(decappingmachine.result.id);
|
// Debug.Log(decappingmachine.result.id);
|
||||||
UICoverremovalmachine.Getdecap(decappingmachine.result.caseLidStatus, decappingmachine.result.frontInPlaceInspection, decappingmachine.result.rearInPlaceInspection, decappingmachine.result.frontDecelerationInspection,
|
UICoverremovalmachine.Getdecap(decappingmachine.result.caseLidStatus, decappingmachine.result.frontInPlaceInspection, decappingmachine.result.rearInPlaceInspection, decappingmachine.result.frontDecelerationInspection,
|
||||||
|
|
|
@ -76,6 +76,10 @@ public static class InterfaceManager
|
||||||
/// Èë¿â»ú
|
/// Èë¿â»ú
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string Intotheface { get => IpAddress + "/api/kepserver/convoyors_IN_Info/"; }
|
public static string Intotheface { get => IpAddress + "/api/kepserver/convoyors_IN_Info/"; }
|
||||||
|
/// <summary>
|
||||||
|
/// MQTT³õʼ»¯½Ó¿Ú
|
||||||
|
/// </summary>
|
||||||
|
public static string Initializes { get => IpAddress + "/api/wmsLocation/palletDetailByPalletNum/"; }
|
||||||
public static IEnumerator Getbytes(string url, Action<string> callback)
|
public static IEnumerator Getbytes(string url, Action<string> callback)
|
||||||
{
|
{
|
||||||
using (UnityWebRequest www = new UnityWebRequest(url))
|
using (UnityWebRequest www = new UnityWebRequest(url))
|
||||||
|
|
|
@ -34,13 +34,13 @@ public class Outboundequipment : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
private async void OnTriggerEnter(Collider other)
|
//private async void OnTriggerEnter(Collider other)
|
||||||
{
|
//{
|
||||||
if (other.gameObject.CompareTag("Box"))
|
// if (other.gameObject.CompareTag("Box"))
|
||||||
{
|
// {
|
||||||
await Shipment(other.gameObject,frame);
|
// await Shipment(other.gameObject,frame);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出货
|
/// 出货
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
using DefaultNamespace;
|
||||||
|
using DG.Tweening;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using static UnityEngine.EventSystems.EventTrigger;
|
||||||
|
|
||||||
|
public class Palletizertent : MonoBehaviour
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备id
|
||||||
|
/// </summary>
|
||||||
|
public string ID;
|
||||||
|
/// <summary>
|
||||||
|
/// 速度
|
||||||
|
/// </summary>
|
||||||
|
public float Speed = 3.5f;
|
||||||
|
[Header("码垛机手臂")]
|
||||||
|
public GameObject Armobj;
|
||||||
|
[Header("需要判断位置的箱子")]
|
||||||
|
public Transform Haveabox;
|
||||||
|
public void Stacking(Dpmequipment cmequipment)
|
||||||
|
{
|
||||||
|
if (cmequipment.TaskNumber != null)
|
||||||
|
{
|
||||||
|
if (cmequipment.boxesNumber == "1" && cmequipment.UpperInPlace == "True")
|
||||||
|
{
|
||||||
|
Suitcase();
|
||||||
|
}
|
||||||
|
else if (cmequipment.boxesNumber == "0" && cmequipment.DownInPlace == "True")
|
||||||
|
{
|
||||||
|
Stow();
|
||||||
|
}
|
||||||
|
else if(cmequipment.boxesNumber == "0"&&cmequipment.MiddleInPlace == "True")
|
||||||
|
{
|
||||||
|
Centreposition();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("没有条件");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 中到位操作
|
||||||
|
/// </summary>
|
||||||
|
private void Centreposition()
|
||||||
|
{
|
||||||
|
if (Armobj.transform.childCount > 0 && Haveabox.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = Armobj.transform.GetChild(0).gameObject;
|
||||||
|
GameObject box2 = Haveabox.transform.GetChild(0).gameObject;
|
||||||
|
if (box != null && box2)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
box2.transform.SetParent(null);
|
||||||
|
Vector3 transform = box2.transform.position;
|
||||||
|
box2.transform.position = box.transform.position;
|
||||||
|
box.transform.position = transform;
|
||||||
|
box2.transform.SetParent(box.transform);
|
||||||
|
if (box.GetComponent<BoxCollider>() != null)
|
||||||
|
{
|
||||||
|
BoxCollider box3 = box.GetComponent<BoxCollider>();
|
||||||
|
box3.center = new Vector3(0, 0, 0);
|
||||||
|
//Debug.Log("把碰撞体给到箱子中心");
|
||||||
|
box.transform.SetParent(Haveabox.transform);
|
||||||
|
Armobj.transform.DOMoveY(Armobj.transform.position.y - 0.23f, 0.2f).SetEase(Ease.InOutQuad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提箱操作
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cmequipment"></param>
|
||||||
|
public void Suitcase()
|
||||||
|
{
|
||||||
|
if (Haveabox.transform.GetChild(0).childCount > 0 && Armobj.transform.childCount == 0)
|
||||||
|
{
|
||||||
|
GameObject box = Haveabox.GetChild(0).GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
Armobj.transform.DOMoveY(Armobj.transform.position.y + 0.2f, 0.2f).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Armobj.transform);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Haveabox.childCount == 1)
|
||||||
|
{
|
||||||
|
GameObject box = Haveabox.transform.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
Armobj.transform.DOMoveY(Armobj.transform.position.y - 1.03f, 0.5f).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Armobj.transform);
|
||||||
|
Armobj.transform.DOMoveY(Armobj.transform.position.y + 1.23f, 0.6f).SetEase(Ease.InOutQuad);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("提箱子啥也不是");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 放下箱子操作
|
||||||
|
/// </summary>
|
||||||
|
public void Stow()
|
||||||
|
{
|
||||||
|
if (Armobj.transform.childCount > 0 && Haveabox.childCount == 0)
|
||||||
|
{
|
||||||
|
Armobj.transform.DOMoveY(Armobj.transform.position.y - 1.23f, 0.5f).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
if (Armobj.transform.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = Armobj.transform.GetChild(0).gameObject;
|
||||||
|
box.transform.SetParent(Haveabox);
|
||||||
|
Armobj.transform.DOMoveY(Armobj.transform.position.y + 1.03f, 0.4f).SetEase(Ease.InOutQuad);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//else if (Armobj.transform.childCount > 0 && Haveabox.childCount > 0)
|
||||||
|
//{
|
||||||
|
// GameObject box = Armobj.transform.GetChild(0).gameObject;
|
||||||
|
// GameObject box2 = Haveabox.transform.GetChild(0).gameObject;
|
||||||
|
// if (box != null && box2)
|
||||||
|
// {
|
||||||
|
// box.transform.SetParent(null);
|
||||||
|
// box2.transform.SetParent(null);
|
||||||
|
// Vector3 transform = box2.transform.position;
|
||||||
|
// box2.transform.position = box.transform.position;
|
||||||
|
// box.transform.position = transform;
|
||||||
|
// box2.transform.SetParent(box.transform);
|
||||||
|
// if (box.GetComponent<BoxCollider>() != null)
|
||||||
|
// {
|
||||||
|
// BoxCollider box3 = box.GetComponent<BoxCollider>();
|
||||||
|
// box3.center = new Vector3(0, 0, 0);
|
||||||
|
// //Debug.Log("把碰撞体给到箱子中心");
|
||||||
|
// box.transform.SetParent(Haveabox.transform);
|
||||||
|
// Armobj.transform.DOMoveY(Armobj.transform.position.y - 0.23f, 0.2f).SetEase(Ease.InOutQuad);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("放箱子啥也不是");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ee183a339edf6f741afd814f5749bb26
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,112 @@
|
||||||
|
using DefaultNamespace;
|
||||||
|
using DG.Tweening;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Warehousingdata : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Header("设备ID")]
|
||||||
|
public string ID;
|
||||||
|
[Header("位移速度")]
|
||||||
|
public float Speed = 3.5f;
|
||||||
|
[Header("正传判断点位是否有箱子")]
|
||||||
|
public Transform Onschedule;
|
||||||
|
[Header("正转需要位移的点位")]
|
||||||
|
public Transform Onschedule2;
|
||||||
|
[Header("反转需要判断点位有箱子")]
|
||||||
|
public Transform Antipoint1;
|
||||||
|
[Header("反转需要位移的点位")]
|
||||||
|
public Transform Antipoint2;
|
||||||
|
[Header("提升机反转需要位移的点位")]
|
||||||
|
public Transform Reversing;
|
||||||
|
[Header("提升机反转需要位移点位2")]
|
||||||
|
public Transform Reversing2;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Equipmentdata(Convoyorequipment convoyorequipment)
|
||||||
|
{
|
||||||
|
if (convoyorequipment.TaskNumber != "0")
|
||||||
|
{
|
||||||
|
if (convoyorequipment.ForwardRotation == "True")
|
||||||
|
{
|
||||||
|
Intotheforword();
|
||||||
|
}
|
||||||
|
else if (convoyorequipment.ReverseRotation == "True")
|
||||||
|
{
|
||||||
|
Tothereversal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 正传点位
|
||||||
|
/// </summary>
|
||||||
|
public void Intotheforword()
|
||||||
|
{
|
||||||
|
if (Onschedule.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = Onschedule.transform.GetChild(0).gameObject;
|
||||||
|
if (box != null)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
box.transform.DOMove(Onschedule2.position, (Vector3.Distance(box.transform.position, Onschedule2.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Onschedule2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 反转点位需要判断
|
||||||
|
/// </summary>
|
||||||
|
public void Tothereversal()
|
||||||
|
{
|
||||||
|
if (Antipoint1.childCount > 0)
|
||||||
|
{
|
||||||
|
GameObject box = Antipoint1.transform.GetChild(0).gameObject;
|
||||||
|
if(box != null)
|
||||||
|
{
|
||||||
|
box.transform.SetParent(null);
|
||||||
|
box.transform.DOMove(Antipoint2.position, (Vector3.Distance(box.transform.position, Antipoint2.transform.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Antipoint2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (GetComponent<Hoistmovement>())
|
||||||
|
{
|
||||||
|
Hoistmovement hoistmovement = GetComponent<Hoistmovement>();
|
||||||
|
if (hoistmovement)
|
||||||
|
{
|
||||||
|
if (hoistmovement.Downpoint.transform.childCount > 0 && Reversing)
|
||||||
|
{
|
||||||
|
GameObject box = hoistmovement.Downpoint.transform.GetChild(0).gameObject;
|
||||||
|
if (box)
|
||||||
|
{
|
||||||
|
box.transform.SetParent (null);
|
||||||
|
box.transform.DOMove(Reversing.position, (Vector3.Distance(box.transform.position, Reversing.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Reversing);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(hoistmovement.UPpoint.transform.childCount > 0 && Reversing2)
|
||||||
|
{
|
||||||
|
GameObject box = hoistmovement.UPpoint.transform.GetChild (0).gameObject;
|
||||||
|
if (box)
|
||||||
|
{
|
||||||
|
box.transform.SetParent (null);
|
||||||
|
box.transform.DOMove(Reversing2.position, (Vector3.Distance(box.transform.position, Reversing2.position) / Speed)).SetEase(Ease.InOutQuad).OnComplete(() =>
|
||||||
|
{
|
||||||
|
box.transform.SetParent(Reversing2);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 343fe62ec1027574bb3d31bc25f36bd8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue