mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 06:57:22 +02:00
switch from Unity version control to git
This commit is contained in:
3
.plastic/plastic.selector
Normal file
3
.plastic/plastic.selector
Normal file
@@ -0,0 +1,3 @@
|
||||
rep "Capstone 2025-06-03_21-02-42/Capstone@3574335016967@cloud"
|
||||
path "/"
|
||||
smartbranch "/main"
|
||||
BIN
.plastic/plastic.wktree
Normal file
BIN
.plastic/plastic.wktree
Normal file
Binary file not shown.
2
.plastic/plastic.workspace
Normal file
2
.plastic/plastic.workspace
Normal file
@@ -0,0 +1,2 @@
|
||||
Capstone 2025-06-03_21-02-42-Capstone
|
||||
67e286c1-71ae-4d21-a6a2-99d4a973b52e
|
||||
BIN
Assets/.DS_Store
vendored
Normal file
BIN
Assets/.DS_Store
vendored
Normal file
Binary file not shown.
90
Assets/AngleControllerSlider.cs
Normal file
90
Assets/AngleControllerSlider.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class AngleControllerSlider : MonoBehaviour
|
||||
{
|
||||
public GameObject angleUI;
|
||||
public Slider angleSlider;
|
||||
public TextMeshProUGUI angleLabel;
|
||||
|
||||
private Transform currentCap;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Debug.Log("AngleControllerSlider script is alive!");
|
||||
|
||||
angleSlider.minValue = 0;
|
||||
angleSlider.maxValue = 180;
|
||||
angleSlider.onValueChanged.AddListener(OnSliderChanged);
|
||||
|
||||
if (angleUI != null)
|
||||
angleUI.SetActive(false);
|
||||
else
|
||||
Debug.LogError("angleUI is not assigned.");
|
||||
}
|
||||
|
||||
private GameObject currentSelectedObject;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (ObjectSelector.selectedObject != null)
|
||||
{
|
||||
if (!angleUI.activeSelf)
|
||||
angleUI.SetActive(true);
|
||||
|
||||
// Detect object switch
|
||||
if (ObjectSelector.selectedObject != currentSelectedObject)
|
||||
{
|
||||
currentSelectedObject = ObjectSelector.selectedObject;
|
||||
|
||||
Debug.Log("[Slider] Selected new object: " + currentSelectedObject.name);
|
||||
|
||||
// Update cap reference
|
||||
Transform newCap = currentSelectedObject.transform.Find("Cap");
|
||||
|
||||
if (newCap != null)
|
||||
{
|
||||
currentCap = newCap;
|
||||
float currentAngle = Mathf.Clamp(currentCap.localEulerAngles.y, 0f, 180f);
|
||||
angleSlider.SetValueWithoutNotify(currentAngle);
|
||||
angleLabel.text = $"Angle: {Mathf.RoundToInt(currentAngle)}°";
|
||||
Debug.Log("[Slider] Found new Cap and updated UI.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[Slider] No Cap found on selected object.");
|
||||
currentCap = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (angleUI.activeSelf)
|
||||
angleUI.SetActive(false);
|
||||
currentSelectedObject = null;
|
||||
currentCap = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnSliderChanged(float value)
|
||||
{
|
||||
if (currentCap != null)
|
||||
{
|
||||
float clampedValue = Mathf.Clamp(value, 0f, 180f);
|
||||
currentCap.localEulerAngles = new Vector3(
|
||||
currentCap.localEulerAngles.x,
|
||||
clampedValue,
|
||||
currentCap.localEulerAngles.z
|
||||
);
|
||||
|
||||
Debug.Log("[Slider] Updated Cap Angle to: " + clampedValue);
|
||||
angleLabel.text = $"Angle: {Mathf.RoundToInt(clampedValue)}°";
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("[Slider] No currentCap to apply angle change.");
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/AngleControllerSlider.cs.meta
Normal file
11
Assets/AngleControllerSlider.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5896b4f959d214ebaac53455f34be7af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
Assets/BlockJointController.cs
Normal file
27
Assets/BlockJointController.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class BlockJointController : MonoBehaviour
|
||||
{
|
||||
public Transform rotatingCap;
|
||||
public Slider angleSlider;
|
||||
public TextMeshProUGUI angleLabel;
|
||||
|
||||
private float currentAngle = 0f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
angleSlider.onValueChanged.AddListener(OnAngleChanged);
|
||||
angleSlider.value = 0;
|
||||
}
|
||||
|
||||
void OnAngleChanged(float value)
|
||||
{
|
||||
currentAngle = value;
|
||||
angleLabel.text = $"Angle: {value:F0}°";
|
||||
|
||||
if (rotatingCap != null)
|
||||
rotatingCap.localRotation = Quaternion.Euler(0, value, 0); // rotate Y
|
||||
}
|
||||
}
|
||||
11
Assets/BlockJointController.cs.meta
Normal file
11
Assets/BlockJointController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 798a9b6e3f3294db0a52a4d478ac59d2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
433
Assets/Block_Unit.prefab
Normal file
433
Assets/Block_Unit.prefab
Normal file
@@ -0,0 +1,433 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1200891181587249277
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5029976407930122987}
|
||||
- component: {fileID: 6687236408905807393}
|
||||
- component: {fileID: 7827191048634593755}
|
||||
- component: {fileID: 7508742954692020342}
|
||||
m_Layer: 0
|
||||
m_Name: Cap
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5029976407930122987
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1200891181587249277}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.3, z: 0}
|
||||
m_LocalScale: {x: 0.8, y: 0.1, z: 0.8}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8416398763267217858}
|
||||
m_Father: {fileID: 7165439342355356436}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &6687236408905807393
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1200891181587249277}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &7827191048634593755
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1200891181587249277}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &7508742954692020342
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1200891181587249277}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 0
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1586001380804434012
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 762631948691746115}
|
||||
- component: {fileID: 9114218392307282109}
|
||||
- component: {fileID: 1132562957618008066}
|
||||
- component: {fileID: 8745725509667591117}
|
||||
m_Layer: 0
|
||||
m_Name: Block_Base
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &762631948691746115
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1586001380804434012}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 0.5, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7165439342355356436}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &9114218392307282109
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1586001380804434012}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1132562957618008066
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1586001380804434012}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &8745725509667591117
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1586001380804434012}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 0
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2676524576268212837
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7165439342355356436}
|
||||
- component: {fileID: 2806561555593288852}
|
||||
- component: {fileID: 1475662903589554615}
|
||||
- component: {fileID: 1848983280643478690}
|
||||
m_Layer: 0
|
||||
m_Name: Block_Unit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7165439342355356436
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2676524576268212837}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 762631948691746115}
|
||||
- {fileID: 5029976407930122987}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2806561555593288852
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2676524576268212837}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 29772497747c64f1c9f423804b77ef7a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
rotationSpeed: 600
|
||||
--- !u!65 &1475662903589554615
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2676524576268212837}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1848983280643478690
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2676524576268212837}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6ef15ac59d51c4c0980e9e3d09da7273, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
dragSpeed: 10
|
||||
scrollSensitivity: 5
|
||||
--- !u!1 &4470307204473123588
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8416398763267217858}
|
||||
- component: {fileID: 4587933165302725957}
|
||||
m_Layer: 0
|
||||
m_Name: Line
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8416398763267217858
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4470307204473123588}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.091, y: 0.59, z: -0.765}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5029976407930122987}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!120 &4587933165302725957
|
||||
LineRenderer:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4470307204473123588}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 0
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10306, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Positions:
|
||||
- {x: 0, y: 0, z: 0}
|
||||
- {x: 0, y: 0, z: 1}
|
||||
m_Parameters:
|
||||
serializedVersion: 3
|
||||
widthMultiplier: 0.1
|
||||
widthCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
colorGradient:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0.9150943, g: 0.15175065, b: 0.12517802, a: 1}
|
||||
key1: {r: 1, g: 1, b: 1, a: 1}
|
||||
key2: {r: 0, g: 0, b: 0, a: 1}
|
||||
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: 65150
|
||||
ctime1: 65535
|
||||
ctime2: 0
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 65535
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 2
|
||||
m_ColorSpace: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
numCornerVertices: 0
|
||||
numCapVertices: 0
|
||||
alignment: 0
|
||||
textureMode: 0
|
||||
textureScale: {x: 1, y: 1}
|
||||
shadowBias: 0.5
|
||||
generateLightingData: 0
|
||||
m_MaskInteraction: 0
|
||||
m_UseWorldSpace: 0
|
||||
m_Loop: 0
|
||||
m_ApplyActiveColorSpace: 1
|
||||
7
Assets/Block_Unit.prefab.meta
Normal file
7
Assets/Block_Unit.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5978cfc8e1c064578895ca85e1ef9fc3
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/ControlLibrary.meta
Normal file
8
Assets/ControlLibrary.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0439de5c33fc247829f2472f105f8fd6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/ControlLibrary/ControlLibrary.cs
Normal file
35
Assets/ControlLibrary/ControlLibrary.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using Google.FlatBuffers;
|
||||
|
||||
public class ControlLibrary : MonoBehaviour
|
||||
{
|
||||
[DllImport("libcontrol")]
|
||||
public static extern void init();
|
||||
|
||||
[DllImport("libcontrol")]
|
||||
public static extern void cleanup();
|
||||
|
||||
[DllImport("libcontrol")]
|
||||
public static extern int send_angle_control(int module_id, int angle);
|
||||
|
||||
[DllImport("libcontrol")]
|
||||
private static extern IntPtr get_configuration(out int module_id); // the data this points to will be invalidated when called again
|
||||
|
||||
|
||||
public static Frontend.RobotConfiguration getRobotConfiguration() // this is not thread safe
|
||||
{
|
||||
int size;
|
||||
IntPtr ptr = get_configuration(out size);
|
||||
|
||||
byte[] buffer = new byte[size];
|
||||
Marshal.Copy(ptr, buffer, 0, size);
|
||||
|
||||
ByteBuffer bb = new ByteBuffer(buffer);
|
||||
var myObject = Frontend.RobotConfiguration.GetRootAsRobotConfiguration(bb);
|
||||
return myObject;
|
||||
}
|
||||
}
|
||||
11
Assets/ControlLibrary/ControlLibrary.cs.meta
Normal file
11
Assets/ControlLibrary/ControlLibrary.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54578cde37c4844c9b593676e0296381
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/ControlLibrary/libcontrol.dll
Normal file
BIN
Assets/ControlLibrary/libcontrol.dll
Normal file
Binary file not shown.
63
Assets/ControlLibrary/libcontrol.dll.meta
Normal file
63
Assets/ControlLibrary/libcontrol.dll.meta
Normal file
@@ -0,0 +1,63 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e245339cbf750a4f9521fd4f064e92f
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 1
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 0
|
||||
Exclude OSXUniversal: 0
|
||||
Exclude Win: 0
|
||||
Exclude Win64: 0
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/ControlLibrary/libcontrol.dylib
Executable file
BIN
Assets/ControlLibrary/libcontrol.dylib
Executable file
Binary file not shown.
33
Assets/ControlLibrary/libcontrol.dylib.meta
Normal file
33
Assets/ControlLibrary/libcontrol.dylib.meta
Normal file
@@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e106a4fd65ba469d815025f404d1916
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
41
Assets/DCMotorControlPanel.cs
Normal file
41
Assets/DCMotorControlPanel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DCMotorControlPanel : MonoBehaviour
|
||||
{
|
||||
public TMP_InputField degreesInputField;
|
||||
public TMP_Dropdown directionDropdown;
|
||||
public Button rotateButton;
|
||||
|
||||
private DCMotorModule currentDCModule;
|
||||
|
||||
public void Initialize(DCMotorModule DCModule)
|
||||
{
|
||||
currentDCModule = DCModule;
|
||||
gameObject.SetActive(true);
|
||||
rotateButton.onClick.RemoveAllListeners();
|
||||
rotateButton.onClick.AddListener(HandleRotateClicked);
|
||||
}
|
||||
|
||||
public void HandleRotateClicked()
|
||||
{
|
||||
// Parse degrees
|
||||
if (!float.TryParse(degreesInputField.text, out float degrees))
|
||||
{
|
||||
Debug.LogWarning("Invalid degree input");
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine direction
|
||||
int direction = directionDropdown.value == 0 ? 1 : -1;
|
||||
currentDCModule.Rotate(degrees, direction);
|
||||
}
|
||||
|
||||
public void HidePanel()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/DCMotorControlPanel.cs.meta
Normal file
11
Assets/DCMotorControlPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81deee5da1fed420a968483eb81ae147
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
82
Assets/DCMotorModule.cs
Normal file
82
Assets/DCMotorModule.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class DCMotorModule : ModuleBase
|
||||
{
|
||||
private static DCMotorControlPanel motorControlPanel;
|
||||
public Transform motorShaft;
|
||||
|
||||
public float rotationSpeed = 90f;
|
||||
private float targetPosition = 0f;
|
||||
private Coroutine followCoroutine;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (motorControlPanel == null)
|
||||
{
|
||||
motorControlPanel = FindObjectOfType<DCMotorControlPanel>(true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSelect()
|
||||
{
|
||||
if (followCoroutine != null)
|
||||
StopCoroutine(followCoroutine);
|
||||
|
||||
followCoroutine = StartCoroutine(FollowPositionForFrames());
|
||||
motorControlPanel.Initialize(this);
|
||||
}
|
||||
|
||||
private IEnumerator FollowPositionForFrames()
|
||||
{
|
||||
RectTransform panelRect = motorControlPanel.GetComponent<RectTransform>();
|
||||
|
||||
float duration = 0.5f;
|
||||
float timer = 0f;
|
||||
|
||||
while (timer < duration)
|
||||
{
|
||||
Vector3 worldPos = transform.position;
|
||||
Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos) + new Vector3(150f, 0f, 0f);
|
||||
panelRect.position = screenPos;
|
||||
|
||||
timer += Time.deltaTime;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeSelect()
|
||||
{
|
||||
motorControlPanel.HidePanel();
|
||||
}
|
||||
|
||||
public void Rotate(float degrees, int direction)
|
||||
{
|
||||
float rotation = degrees * direction;
|
||||
targetPosition += rotation;
|
||||
this.SendToControlLibrary("DC", targetPosition);
|
||||
StartCoroutine(RotateOverTime(rotation));
|
||||
}
|
||||
|
||||
private IEnumerator RotateOverTime(float rotation)
|
||||
{
|
||||
float currentRotationDegrees = 0f;
|
||||
|
||||
while (Mathf.Abs(currentRotationDegrees) < Mathf.Abs(rotation))
|
||||
{
|
||||
float step = rotationSpeed * Time.deltaTime;
|
||||
if (Mathf.Abs(currentRotationDegrees + step) > Mathf.Abs(rotation))
|
||||
{
|
||||
step = Mathf.Abs(rotation) - Mathf.Abs(currentRotationDegrees);
|
||||
}
|
||||
|
||||
motorShaft.Rotate(Vector3.up, step * Mathf.Sign(rotation));
|
||||
currentRotationDegrees += step * Mathf.Sign(rotation);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/DCMotorModule.cs.meta
Normal file
11
Assets/DCMotorModule.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 010a1e64e11ea4ea48068fa4ba025b46
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
66
Assets/DragMove.cs
Normal file
66
Assets/DragMove.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DragMove : MonoBehaviour
|
||||
{
|
||||
public float dragSpeed = 10f;
|
||||
public float scrollSensitivity = 5f;
|
||||
private bool isDragging = false;
|
||||
private float dragDepth;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(Input.GetMouseButtonDown(1))
|
||||
{
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); //Creates ray object where a ray is sent from the camera to your mouse position
|
||||
if(Physics.Raycast(ray, out RaycastHit hit) && hit.transform == transform) //Checks if ray hit this exact object and not some other object
|
||||
{
|
||||
// dragPlane = new Plane(Camera.main.transform.forward * -1, transform.position); //Creates invisible horizontal plane that passes through the object's current position, used to calculate where in 3D space the mouse is pointing as you drag
|
||||
// if(dragPlane.Raycast(ray, out float distance)) //Calculates where the mouse ray intersects that invisible plane
|
||||
// {
|
||||
// offset = transform.position - ray.GetPoint(distance); //Gets the actual 3D position on the plane where the ray hit and clculates how far the object’s current position is from the mouse point
|
||||
// isDragging = true;
|
||||
// }
|
||||
isDragging = true;
|
||||
dragDepth = Vector3.Distance(Camera.main.transform.position, transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
if(Input.GetMouseButtonUp(1))
|
||||
{
|
||||
isDragging = false;
|
||||
}
|
||||
|
||||
if(isDragging)
|
||||
{
|
||||
// Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
// // Intersect with an invisible plane that is defined by the object's current position and normal
|
||||
// Plane dragPlane = new Plane(-Camera.main.transform.forward, transform.position);
|
||||
|
||||
// if (dragPlane.Raycast(ray, out float distance))
|
||||
// {
|
||||
// Vector3 hitPoint = ray.GetPoint(distance);
|
||||
// Vector3 targetPosition = hitPoint + offset;
|
||||
|
||||
// transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * dragSpeed);
|
||||
// }
|
||||
|
||||
if(Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
|
||||
{
|
||||
dragDepth -= scrollSensitivity * Time.deltaTime;
|
||||
}
|
||||
if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
|
||||
{
|
||||
dragDepth += scrollSensitivity * Time.deltaTime;
|
||||
}
|
||||
dragDepth = Mathf.Clamp(dragDepth, 1f, 20f);
|
||||
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
Vector3 targetPos = ray.origin + ray.direction * dragDepth;
|
||||
transform.position = Vector3.Lerp(transform.position, targetPos, Time.deltaTime * dragSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/DragMove.cs.meta
Normal file
11
Assets/DragMove.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ef15ac59d51c4c0980e9e3d09da7273
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/DragRotate.cs
Normal file
31
Assets/DragRotate.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class DragRotate : MonoBehaviour
|
||||
{
|
||||
public float rotationSpeed = 100f;
|
||||
private bool isSelected = false;
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
isSelected = true;
|
||||
}
|
||||
|
||||
void OnMouseUp()
|
||||
{
|
||||
isSelected = false;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButton(0) && isSelected)
|
||||
{
|
||||
float mouseX = Input.GetAxis("Mouse X");
|
||||
float mouseY = Input.GetAxis("Mouse Y");
|
||||
|
||||
// Horizontal (Y axis)
|
||||
transform.Rotate(Vector3.up, -mouseX * rotationSpeed * Time.deltaTime, Space.World);
|
||||
// Vertical (X axis)
|
||||
transform.Rotate(Vector3.right, mouseY * rotationSpeed * Time.deltaTime, Space.World);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/DragRotate.cs.meta
Normal file
11
Assets/DragRotate.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29772497747c64f1c9f423804b77ef7a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/FlatBuffers.meta
Normal file
8
Assets/FlatBuffers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccaae92222804458d99f40d8a71b14f9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1041
Assets/FlatBuffers/ByteBuffer.cs
Normal file
1041
Assets/FlatBuffers/ByteBuffer.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Assets/FlatBuffers/ByteBuffer.cs.meta
Normal file
11
Assets/FlatBuffers/ByteBuffer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bc7c0c32eb3f47cca26e2797eb219c9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/FlatBuffers/ByteBufferUtil.cs
Normal file
39
Assets/FlatBuffers/ByteBufferUtil.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Google.FlatBuffers
|
||||
{
|
||||
/// <summary>
|
||||
/// Class that collects utility functions around `ByteBuffer`.
|
||||
/// </summary>
|
||||
public class ByteBufferUtil
|
||||
{
|
||||
// Extract the size prefix from a `ByteBuffer`.
|
||||
public static int GetSizePrefix(ByteBuffer bb) {
|
||||
return bb.GetInt(bb.Position);
|
||||
}
|
||||
|
||||
// Create a duplicate of a size-prefixed `ByteBuffer` that has its position
|
||||
// advanced just past the size prefix.
|
||||
public static ByteBuffer RemoveSizePrefix(ByteBuffer bb) {
|
||||
ByteBuffer s = bb.Duplicate();
|
||||
s.Position += FlatBufferConstants.SizePrefixLength;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/FlatBuffers/ByteBufferUtil.cs.meta
Normal file
11
Assets/FlatBuffers/ByteBufferUtil.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca2c0ac0910184ec28bbe16c03fa3205
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1023
Assets/FlatBuffers/FlatBufferBuilder.cs
Normal file
1023
Assets/FlatBuffers/FlatBufferBuilder.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Assets/FlatBuffers/FlatBufferBuilder.cs.meta
Normal file
11
Assets/FlatBuffers/FlatBufferBuilder.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0b71a6c924c845469e5d428885ef45e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Assets/FlatBuffers/FlatBufferConstants.cs
Normal file
37
Assets/FlatBuffers/FlatBufferConstants.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Google.FlatBuffers
|
||||
{
|
||||
public static class FlatBufferConstants
|
||||
{
|
||||
public const int FileIdentifierLength = 4;
|
||||
public const int SizePrefixLength = 4;
|
||||
/** A version identifier to force a compile error if someone
|
||||
accidentally tries to build generated code with a runtime of
|
||||
two mismatched version. Versions need to always match, as
|
||||
the runtime and generated code are modified in sync.
|
||||
Changes to the C# implementation need to be sure to change
|
||||
the version here and in the code generator on every possible
|
||||
incompatible change */
|
||||
public static void FLATBUFFERS_24_12_23() {}
|
||||
}
|
||||
}
|
||||
11
Assets/FlatBuffers/FlatBufferConstants.cs.meta
Normal file
11
Assets/FlatBuffers/FlatBufferConstants.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3f9ab8cda5db4db1ad64fe52de72954
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
822
Assets/FlatBuffers/FlatBufferVerify.cs
Normal file
822
Assets/FlatBuffers/FlatBufferVerify.cs
Normal file
@@ -0,0 +1,822 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Reflection;using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Google.FlatBuffers
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The Class of the Verifier Options
|
||||
/// </summary>
|
||||
public class Options
|
||||
{
|
||||
public const int DEFAULT_MAX_DEPTH = 64;
|
||||
public const int DEFAULT_MAX_TABLES = 1000000;
|
||||
|
||||
private int max_depth = 0;
|
||||
private int max_tables = 0;
|
||||
private bool string_end_check = false;
|
||||
private bool alignment_check = false;
|
||||
|
||||
public Options()
|
||||
{
|
||||
max_depth = DEFAULT_MAX_DEPTH;
|
||||
max_tables = DEFAULT_MAX_TABLES;
|
||||
string_end_check = true;
|
||||
alignment_check = true;
|
||||
}
|
||||
|
||||
public Options(int maxDepth, int maxTables, bool stringEndCheck, bool alignmentCheck)
|
||||
{
|
||||
max_depth = maxDepth;
|
||||
max_tables = maxTables;
|
||||
string_end_check = stringEndCheck;
|
||||
alignment_check = alignmentCheck;
|
||||
}
|
||||
/// <summary> Maximum depth of nested tables allowed in a valid flatbuffer. </summary>
|
||||
public int maxDepth
|
||||
{
|
||||
get { return max_depth; }
|
||||
set { max_depth = value; }
|
||||
}
|
||||
/// <summary> Maximum number of tables allowed in a valid flatbuffer. </summary>
|
||||
public int maxTables
|
||||
{
|
||||
get { return max_tables; }
|
||||
set { max_tables = value; }
|
||||
}
|
||||
/// <summary> Check that string contains its null terminator </summary>
|
||||
public bool stringEndCheck
|
||||
{
|
||||
get { return string_end_check; }
|
||||
set { string_end_check = value; }
|
||||
}
|
||||
/// <summary> Check alignment of elements </summary>
|
||||
public bool alignmentCheck
|
||||
{
|
||||
get { return alignment_check; }
|
||||
set { alignment_check = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public struct checkElementStruct
|
||||
{
|
||||
public bool elementValid;
|
||||
public uint elementOffset;
|
||||
}
|
||||
|
||||
public delegate bool VerifyTableAction(Verifier verifier, uint tablePos);
|
||||
public delegate bool VerifyUnionAction(Verifier verifier, byte typeId, uint tablePos);
|
||||
|
||||
/// <summary>
|
||||
/// The Main Class of the FlatBuffer Verifier
|
||||
/// </summary>
|
||||
public class Verifier
|
||||
{
|
||||
private ByteBuffer verifier_buffer = null;
|
||||
private Options verifier_options = null;
|
||||
private int depth_cnt = 0;
|
||||
private int num_tables_cnt = 0;
|
||||
|
||||
public const int SIZE_BYTE = 1;
|
||||
public const int SIZE_INT = 4;
|
||||
public const int SIZE_U_OFFSET = 4;
|
||||
public const int SIZE_S_OFFSET = 4;
|
||||
public const int SIZE_V_OFFSET = 2;
|
||||
public const int SIZE_PREFIX_LENGTH = FlatBufferConstants.SizePrefixLength; // default size = 4
|
||||
public const int FLATBUFFERS_MAX_BUFFER_SIZE = System.Int32.MaxValue; // default size = 2147483647
|
||||
public const int FILE_IDENTIFIER_LENGTH = FlatBufferConstants.FileIdentifierLength; // default size = 4
|
||||
|
||||
/// <summary> The Base Constructor of the Verifier object </summary>
|
||||
public Verifier()
|
||||
{
|
||||
// Verifier buffer
|
||||
verifier_buffer = null;
|
||||
// Verifier settings
|
||||
verifier_options = null;
|
||||
// Depth counter
|
||||
depth_cnt = 0;
|
||||
// Tables counter
|
||||
num_tables_cnt = 0;
|
||||
}
|
||||
|
||||
/// <summary> The Constructor of the Verifier object with input parameters: ByteBuffer and/or Options </summary>
|
||||
/// <param name="buf"> Input flat byte buffer defined as ByteBuffer type</param>
|
||||
/// <param name="options"> Options object with settings for the coniguration the Verifier </param>
|
||||
public Verifier(ByteBuffer buf, Options options = null)
|
||||
{
|
||||
verifier_buffer = buf;
|
||||
verifier_options = options ?? new Options();
|
||||
depth_cnt = 0;
|
||||
num_tables_cnt = 0;
|
||||
}
|
||||
|
||||
/// <summary> Bytes Buffer for Verify</summary>
|
||||
public ByteBuffer Buf
|
||||
{
|
||||
get { return verifier_buffer; }
|
||||
set { verifier_buffer = value; }
|
||||
}
|
||||
/// <summary> Options of the Verifier </summary>
|
||||
public Options options
|
||||
{
|
||||
get { return verifier_options; }
|
||||
set { verifier_options = value; }
|
||||
}
|
||||
/// <summary> Counter of tables depth in a tested flatbuffer </summary>
|
||||
public int depth
|
||||
{
|
||||
get { return depth_cnt; }
|
||||
set { depth_cnt = value; }
|
||||
}
|
||||
/// <summary> Counter of tables in a tested flatbuffer </summary>
|
||||
public int numTables
|
||||
{
|
||||
get { return num_tables_cnt; }
|
||||
set { num_tables_cnt = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Method set maximum tables depth of valid structure</summary>
|
||||
/// <param name="value"> Specify Value of the maximum depth of the structure</param>
|
||||
public Verifier SetMaxDepth(int value)
|
||||
{
|
||||
verifier_options.maxDepth = value;
|
||||
return this;
|
||||
}
|
||||
/// <summary> Specify maximum number of tables in structure </summary>
|
||||
/// <param name="value"> Specify Value of the maximum number of the tables in the structure</param>
|
||||
public Verifier SetMaxTables(int value)
|
||||
{
|
||||
verifier_options.maxTables = value;
|
||||
return this;
|
||||
}
|
||||
/// <summary> Enable/disable buffer content alignment check </summary>
|
||||
/// <param name="value"> Value of the State for buffer content alignment check (Enable = true) </param>
|
||||
public Verifier SetAlignmentCheck(bool value)
|
||||
{
|
||||
verifier_options.alignmentCheck = value;
|
||||
return this;
|
||||
}
|
||||
/// <summary> Enable/disable checking of string termination '0' character </summary>
|
||||
/// <param name="value"> Value of the option for string termination '0' character check (Enable = true)</param>
|
||||
public Verifier SetStringCheck(bool value)
|
||||
{
|
||||
verifier_options.stringEndCheck = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary> Check if there is identifier in buffer </summary>
|
||||
/// <param name="buf"> Input flat byte buffer defined as ByteBuffer type </param>
|
||||
/// <param name="startPos">Start position of data in the Byte Buffer</param>
|
||||
/// <param name="identifier"> Identifier for the Byte Buffer</param>
|
||||
/// <returns> Return True when the Byte Buffer Identifier is present</returns>
|
||||
private bool BufferHasIdentifier(ByteBuffer buf, uint startPos, string identifier)
|
||||
{
|
||||
if (identifier.Length != FILE_IDENTIFIER_LENGTH)
|
||||
{
|
||||
throw new ArgumentException("FlatBuffers: file identifier must be length" + Convert.ToString(FILE_IDENTIFIER_LENGTH));
|
||||
}
|
||||
for (int i = 0; i < FILE_IDENTIFIER_LENGTH; i++)
|
||||
{
|
||||
if ((sbyte)identifier[i] != verifier_buffer.GetSbyte(Convert.ToInt32(SIZE_S_OFFSET + i + startPos)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Get UOffsetT from buffer at given position - it must be verified before read </summary>
|
||||
/// <param name="buf"> Input flat byte buffer defined as ByteBuffer type </param>
|
||||
/// <param name="pos"> Position of data in the Byte Buffer</param>
|
||||
/// <returns> Return the UOffset Value (Unsigned Integer type - 4 bytes) in pos </returns>
|
||||
private uint ReadUOffsetT(ByteBuffer buf, uint pos)
|
||||
{
|
||||
return buf.GetUint(Convert.ToInt32(pos));
|
||||
}
|
||||
/// <summary> Get SOffsetT from buffer at given position - it must be verified before read </summary>
|
||||
/// <param name="buf"> Input flat byte buffer defined as ByteBuffer type </param>
|
||||
/// <param name="pos"> Position of data in the Byte Buffer</param>
|
||||
/// <returns> Return the SOffset Value (Signed Integer type - 4 bytes) in pos </returns>
|
||||
private int ReadSOffsetT(ByteBuffer buf, int pos)
|
||||
{
|
||||
return buf.GetInt(pos);
|
||||
}
|
||||
/// <summary> Get VOffsetT from buffer at given position - it must be verified before read </summary>
|
||||
/// <param name="buf"> Input flat byte buffer defined as ByteBuffer type </param>
|
||||
/// <param name="pos"> Position of data in the Byte Buffer</param>
|
||||
/// <returns> Return the VOffset Value (Short type - 2 bytes) in pos </returns>
|
||||
private short ReadVOffsetT(ByteBuffer buf, int pos)
|
||||
{
|
||||
return buf.GetShort(pos);
|
||||
}
|
||||
|
||||
/// <summary> Get table data area relative offset from vtable. Result is relative to table start
|
||||
/// Fields which are deprecated are ignored by checking against the vtable's length. </summary>
|
||||
/// <param name="pos"> Position of data in the Byte Buffer </param>
|
||||
/// <param name="vtableOffset"> offset of value in the Table</param>
|
||||
/// <returns> Return the relative VOffset Value (Short type - 2 bytes) in calculated offset </returns>
|
||||
private short GetVRelOffset(int pos, short vtableOffset)
|
||||
{
|
||||
short VOffset = 0;
|
||||
// Used try/catch because pos typa as int 32bit
|
||||
try
|
||||
{
|
||||
// First, get vtable offset
|
||||
short vtable = Convert.ToInt16(pos - ReadSOffsetT(verifier_buffer, pos));
|
||||
// Check that offset points to vtable area (is smaller than vtable size)
|
||||
if (vtableOffset < ReadVOffsetT(verifier_buffer, vtable))
|
||||
{
|
||||
// Now, we can read offset value - TODO check this value against size of table data
|
||||
VOffset = ReadVOffsetT(verifier_buffer, vtable + vtableOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
VOffset = 0;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception: {0}", e);
|
||||
return VOffset;
|
||||
}
|
||||
return VOffset;
|
||||
|
||||
}
|
||||
/// <summary> Get table data area absolute offset from vtable. Result is the absolute buffer offset.
|
||||
/// The result value offset cannot be '0' (pointing to itself) so after validation this method returnes '0'
|
||||
/// value as a marker for missing optional entry </summary>
|
||||
/// <param name="tablePos"> Table Position value in the Byte Buffer </param>
|
||||
/// <param name="vtableOffset"> offset value in the Table</param>
|
||||
/// <returns> Return the absolute UOffset Value </returns>
|
||||
private uint GetVOffset(uint tablePos, short vtableOffset)
|
||||
{
|
||||
uint UOffset = 0;
|
||||
// First, get vtable relative offset
|
||||
short relPos = GetVRelOffset(Convert.ToInt32(tablePos), vtableOffset);
|
||||
if (relPos != 0)
|
||||
{
|
||||
// Calculate offset based on table postion
|
||||
UOffset = Convert.ToUInt32(tablePos + relPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
UOffset = 0;
|
||||
}
|
||||
return UOffset;
|
||||
}
|
||||
|
||||
/// <summary> Check flatbuffer complexity (tables depth, elements counter and so on) </summary>
|
||||
/// <returns> If complexity is too high function returns false as verification error </returns>
|
||||
private bool CheckComplexity()
|
||||
{
|
||||
return ((depth <= options.maxDepth) && (numTables <= options.maxTables));
|
||||
}
|
||||
|
||||
/// <summary> Check alignment of element. </summary>
|
||||
/// <returns> Return True when alignment of the element is correct</returns>
|
||||
private bool CheckAlignment(uint element, ulong align)
|
||||
{
|
||||
return (((element & (align - 1)) == 0) || (!options.alignmentCheck));
|
||||
}
|
||||
|
||||
/// <summary> Check if element is valid in buffer area. </summary>
|
||||
/// <param name="pos"> Value defines the offset/position to element</param>
|
||||
/// <param name="elementSize"> Size of element</param>
|
||||
/// <returns> Return True when Element is correct </returns>
|
||||
private bool CheckElement(uint pos, ulong elementSize)
|
||||
{
|
||||
return ((elementSize < Convert.ToUInt64(verifier_buffer.Length)) && (pos <= (Convert.ToUInt32(verifier_buffer.Length) - elementSize)));
|
||||
}
|
||||
/// <summary> Check if element is a valid scalar. </summary>
|
||||
/// <param name="pos"> Value defines the offset to scalar</param>
|
||||
/// <param name="elementSize"> Size of element</param>
|
||||
/// <returns> Return True when Scalar Element is correct </returns>
|
||||
private bool CheckScalar(uint pos, ulong elementSize)
|
||||
{
|
||||
return ((CheckAlignment(pos, elementSize)) && (CheckElement(pos, elementSize)));
|
||||
}
|
||||
/// <summary> Check offset. It is a scalar with size of UOffsetT. </summary>
|
||||
private bool CheckOffset(uint offset)
|
||||
{
|
||||
return (CheckScalar(offset, SIZE_U_OFFSET));
|
||||
}
|
||||
|
||||
private checkElementStruct CheckVectorOrString(uint pos, ulong elementSize)
|
||||
{
|
||||
var result = new checkElementStruct
|
||||
{
|
||||
elementValid = false,
|
||||
elementOffset = 0
|
||||
};
|
||||
|
||||
uint vectorPos = pos;
|
||||
// Check we can read the vector/string size field (it is of uoffset size)
|
||||
if (!CheckScalar(vectorPos, SIZE_U_OFFSET))
|
||||
{
|
||||
// result.elementValid = false; result.elementOffset = 0;
|
||||
return result;
|
||||
}
|
||||
// Check the whole array. If this is a string, the byte past the array
|
||||
// must be 0.
|
||||
uint size = ReadUOffsetT(verifier_buffer, vectorPos);
|
||||
ulong max_elements = (FLATBUFFERS_MAX_BUFFER_SIZE / elementSize);
|
||||
if (size >= max_elements)
|
||||
{
|
||||
// Protect against byte_size overflowing.
|
||||
// result.elementValid = false; result.elementOffset = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
uint bytes_size = SIZE_U_OFFSET + (Convert.ToUInt32(elementSize) * size);
|
||||
uint buffer_end_pos = vectorPos + bytes_size;
|
||||
result.elementValid = CheckElement(vectorPos, bytes_size);
|
||||
result.elementOffset = buffer_end_pos;
|
||||
return (result);
|
||||
}
|
||||
|
||||
/// <summary>Verify a string at given position.</summary>
|
||||
private bool CheckString(uint pos)
|
||||
{
|
||||
var result = CheckVectorOrString(pos, SIZE_BYTE);
|
||||
if (options.stringEndCheck)
|
||||
{
|
||||
result.elementValid = result.elementValid && CheckScalar(result.elementOffset, 1); // Must have terminator
|
||||
result.elementValid = result.elementValid && (verifier_buffer.GetSbyte(Convert.ToInt32(result.elementOffset)) == 0); // Terminating byte must be 0.
|
||||
}
|
||||
return result.elementValid;
|
||||
}
|
||||
|
||||
/// <summary> Verify the vector of elements of given size </summary>
|
||||
private bool CheckVector(uint pos, ulong elementSize)
|
||||
{
|
||||
var result = CheckVectorOrString(pos, elementSize);
|
||||
return result.elementValid;
|
||||
}
|
||||
/// <summary> Verify table content using structure dependent generated function </summary>
|
||||
private bool CheckTable(uint tablePos, VerifyTableAction verifyAction)
|
||||
{
|
||||
return verifyAction(this, tablePos);
|
||||
}
|
||||
|
||||
/// <summary> String check wrapper function to be used in vector of strings check </summary>
|
||||
private bool CheckStringFunc(Verifier verifier, uint pos)
|
||||
{
|
||||
return verifier.CheckString(pos);
|
||||
}
|
||||
|
||||
/// <summary> Check vector of objects. Use generated object verification function </summary>
|
||||
private bool CheckVectorOfObjects(uint pos, VerifyTableAction verifyAction)
|
||||
{
|
||||
if (!CheckVector(pos, SIZE_U_OFFSET))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint size = ReadUOffsetT(verifier_buffer, pos);
|
||||
// Vector data starts just after vector size/length
|
||||
uint vecStart = pos + SIZE_U_OFFSET;
|
||||
uint vecOff = 0;
|
||||
// Iterate offsets and verify referenced objects
|
||||
for (uint i = 0; i < size; i++)
|
||||
{
|
||||
vecOff = vecStart + (i * SIZE_U_OFFSET);
|
||||
if (!CheckIndirectOffset(vecOff))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint objOffset = GetIndirectOffset(vecOff);
|
||||
if (!verifyAction(this, objOffset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Check if the offset referenced by offsetPos is the valid offset pointing to buffer</summary>
|
||||
// offsetPos - offset to offset data
|
||||
private bool CheckIndirectOffset(uint pos)
|
||||
{
|
||||
// Check the input offset is valid
|
||||
if(!CheckScalar(pos, SIZE_U_OFFSET))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Get indirect offset
|
||||
uint offset = ReadUOffsetT(verifier_buffer, pos);
|
||||
// May not point to itself neither wrap around (buffers are max 2GB)
|
||||
if ((offset == 0) || (offset >= FLATBUFFERS_MAX_BUFFER_SIZE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Must be inside the buffer
|
||||
return CheckElement(pos + offset, 1);
|
||||
}
|
||||
|
||||
/// <summary> Check flatbuffer content using generated object verification function </summary>
|
||||
private bool CheckBufferFromStart(string identifier, uint startPos, VerifyTableAction verifyAction)
|
||||
{
|
||||
if ((identifier != null) &&
|
||||
(identifier.Length == 0) &&
|
||||
((verifier_buffer.Length < (SIZE_U_OFFSET + FILE_IDENTIFIER_LENGTH)) || (!BufferHasIdentifier(verifier_buffer, startPos, identifier))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(!CheckIndirectOffset(startPos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint offset = GetIndirectOffset(startPos);
|
||||
return CheckTable(offset, verifyAction); // && GetComputedSize()
|
||||
}
|
||||
|
||||
/// <summary> Get indirect offset. It is an offset referenced by offset Pos </summary>
|
||||
private uint GetIndirectOffset(uint pos)
|
||||
{
|
||||
// Get indirect offset referenced by offsetPos
|
||||
uint offset = pos + ReadUOffsetT(verifier_buffer, pos);
|
||||
return offset;
|
||||
}
|
||||
|
||||
/// <summary> Verify beginning of table </summary>
|
||||
/// <param name="tablePos"> Position in the Table </param>
|
||||
/// <returns> Return True when the verification of the beginning of the table is passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyTableStart(uint tablePos)
|
||||
{
|
||||
// Starting new table verification increases complexity of structure
|
||||
depth_cnt++;
|
||||
num_tables_cnt++;
|
||||
|
||||
if (!CheckScalar(tablePos, SIZE_S_OFFSET))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint vtable = (uint)(tablePos - ReadSOffsetT(verifier_buffer, Convert.ToInt32(tablePos)));
|
||||
return ((CheckComplexity()) && (CheckScalar(vtable, SIZE_V_OFFSET)) && (CheckAlignment(Convert.ToUInt32(ReadVOffsetT(verifier_buffer, Convert.ToInt32(vtable))), SIZE_V_OFFSET)) && (CheckElement(vtable, Convert.ToUInt64(ReadVOffsetT(verifier_buffer, Convert.ToInt32(vtable))))));
|
||||
}
|
||||
|
||||
/// <summary> Verify end of table. In practice, this function does not check buffer but handles
|
||||
/// verification statistics update </summary>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyTableEnd(uint tablePos)
|
||||
{
|
||||
depth--;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Verifiy static/inlined data area field </summary>
|
||||
/// <param name="tablePos"> Position in the Table</param>
|
||||
/// <param name="offsetId"> Offset to the static/inlined data element </param>
|
||||
/// <param name="elementSize"> Size of the element </param>
|
||||
/// <param name="align"> Alignment bool value </param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
/// <returns>Return True when the verification of the static/inlined data element is passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyField(uint tablePos, short offsetId, ulong elementSize, ulong align, bool required)
|
||||
{
|
||||
uint offset = GetVOffset(tablePos, offsetId);
|
||||
if (offset != 0)
|
||||
{
|
||||
return ((CheckAlignment(offset, align)) && (CheckElement(offset, elementSize)));
|
||||
}
|
||||
return !required; // it is OK if field is not required
|
||||
}
|
||||
|
||||
/// <summary> Verify string </summary>
|
||||
/// <param name="tablePos"> Position in the Table</param>
|
||||
/// <param name="vOffset"> Offset to the String element </param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
/// <returns>Return True when the verification of the String is passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyString(uint tablePos, short vOffset, bool required)
|
||||
{
|
||||
var offset = GetVOffset(tablePos, vOffset);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var strOffset = GetIndirectOffset(offset);
|
||||
return CheckString(strOffset);
|
||||
}
|
||||
|
||||
/// <summary> Verify vector of fixed size structures and scalars </summary>
|
||||
/// <param name="tablePos"> Position in the Table</param>
|
||||
/// <param name="vOffset"> Offset to the Vector of Data </param>
|
||||
/// <param name="elementSize"> Size of the element</param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
/// <returns>Return True when the verification of the Vector of Data passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyVectorOfData(uint tablePos, short vOffset, ulong elementSize, bool required)
|
||||
{
|
||||
var offset = GetVOffset(tablePos, vOffset);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var vecOffset = GetIndirectOffset(offset);
|
||||
return CheckVector(vecOffset, elementSize);
|
||||
}
|
||||
|
||||
/// <summary> Verify array of strings </summary>
|
||||
/// <param name="tablePos"> Position in the Table</param>
|
||||
/// <param name="offsetId"> Offset to the Vector of String </param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
/// <returns>Return True when the verification of the Vector of String passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyVectorOfStrings(uint tablePos, short offsetId, bool required)
|
||||
{
|
||||
var offset = GetVOffset(tablePos, offsetId);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var vecOffset = GetIndirectOffset(offset);
|
||||
return CheckVectorOfObjects(vecOffset, CheckStringFunc);
|
||||
}
|
||||
|
||||
/// <summary> Verify vector of tables (objects). Tables are verified using generated verifyObjFunc </summary>
|
||||
/// <param name="tablePos"> Position in the Table</param>
|
||||
/// <param name="offsetId"> Offset to the Vector of Table </param>
|
||||
/// <param name="verifyAction"> Method used to the verification Table </param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
/// <returns>Return True when the verification of the Vector of Table passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyVectorOfTables(uint tablePos, short offsetId, VerifyTableAction verifyAction, bool required)
|
||||
{
|
||||
var offset = GetVOffset(tablePos, offsetId);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var vecOffset = GetIndirectOffset(offset);
|
||||
return CheckVectorOfObjects(vecOffset, verifyAction);
|
||||
}
|
||||
|
||||
/// <summary> Verify table object using generated verification function. </summary>
|
||||
/// <param name="tablePos"> Position in the Table</param>
|
||||
/// <param name="offsetId"> Offset to the Table </param>
|
||||
/// <param name="verifyAction"> Method used to the verification Table </param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
/// <returns>Return True when the verification of the Table passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyTable(uint tablePos, short offsetId, VerifyTableAction verifyAction, bool required)
|
||||
{
|
||||
var offset = GetVOffset(tablePos, offsetId);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var tabOffset = GetIndirectOffset(offset);
|
||||
return CheckTable(tabOffset, verifyAction);
|
||||
}
|
||||
|
||||
/// <summary> Verify nested buffer object. When verifyObjFunc is provided, it is used to verify object structure. </summary>
|
||||
/// <param name="tablePos"> Position in the Table </param>
|
||||
/// <param name="offsetId"> Offset to the Table </param>
|
||||
/// <param name="verifyAction"> Method used to the verification Table </param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyNestedBuffer(uint tablePos, short offsetId, VerifyTableAction verifyAction, bool required)
|
||||
{
|
||||
var offset = GetVOffset(tablePos, offsetId);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
uint vecOffset = GetIndirectOffset(offset);
|
||||
if (!CheckVector(vecOffset, SIZE_BYTE))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (verifyAction != null)
|
||||
{
|
||||
var vecLength = ReadUOffsetT(verifier_buffer, vecOffset);
|
||||
// Buffer begins after vector length
|
||||
var vecStart = vecOffset + SIZE_U_OFFSET;
|
||||
// Create and Copy nested buffer bytes from part of Verify Buffer
|
||||
var nestedByteBuffer = new ByteBuffer(verifier_buffer.ToArray(Convert.ToInt32(vecStart), Convert.ToInt32(vecLength)));
|
||||
var nestedVerifyier = new Verifier(nestedByteBuffer, options);
|
||||
// There is no internal identifier - use empty one
|
||||
if (!nestedVerifyier.CheckBufferFromStart("", 0, verifyAction))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary> Verifiy static/inlined data area at absolute offset </summary>
|
||||
/// <param name="pos"> Position of static/inlined data area in the Byte Buffer</param>
|
||||
/// <param name="elementSize"> Size of the union data</param>
|
||||
/// <param name="align"> Alignment bool value </param>
|
||||
/// <returns>Return True when the verification of the Union Data is passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyUnionData(uint pos, ulong elementSize, ulong align)
|
||||
{
|
||||
bool result = ((CheckAlignment(pos, align)) && (CheckElement(pos, elementSize)));
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary> Verify string referenced by absolute offset value </summary>
|
||||
/// <param name="pos"> Position of Union String in the Byte Buffer</param>
|
||||
/// <returns>Return True when the verification of the Union String is passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyUnionString(uint pos)
|
||||
{
|
||||
bool result = CheckString(pos);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary> Method verifies union object using generated verification function </summary>
|
||||
/// <param name="tablePos"> Position in the Table</param>
|
||||
/// <param name="typeIdVOffset"> Offset in the Table</param>
|
||||
/// <param name="valueVOffset"> Offset to Element</param>
|
||||
/// <param name="verifyAction"> Verification Method used for Union</param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyUnion(uint tablePos, short typeIdVOffset, short valueVOffset, VerifyUnionAction verifyAction, bool required)
|
||||
{
|
||||
// Check the union type index
|
||||
var offset = GetVOffset(tablePos, typeIdVOffset);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
if (!((CheckAlignment(offset, SIZE_BYTE)) && (CheckElement(offset, SIZE_BYTE))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Check union data
|
||||
offset = GetVOffset(tablePos, valueVOffset);
|
||||
// Take type id
|
||||
var typeId = verifier_buffer.Get(Convert.ToInt32(offset));
|
||||
if (offset == 0)
|
||||
{
|
||||
// When value data is not present, allow union verification function to deal with illegal offset
|
||||
return verifyAction(this, typeId, Convert.ToUInt32(verifier_buffer.Length));
|
||||
}
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Take value offset and validate union structure
|
||||
uint unionOffset = GetIndirectOffset(offset);
|
||||
return verifyAction(this, typeId, unionOffset);
|
||||
}
|
||||
|
||||
/// <summary> Verify vector of unions (objects). Unions are verified using generated verifyObjFunc </summary>
|
||||
/// <param name="tablePos"> Position of the Table</param>
|
||||
/// <param name="typeOffsetId"> Offset in the Table (Union type id)</param>
|
||||
/// <param name="offsetId"> Offset to vector of Data Stucture offset</param>
|
||||
/// <param name="verifyAction"> Verification Method used for Union</param>
|
||||
/// <param name="required"> Required Value when the offset == 0 </param>
|
||||
/// <returns>Return True when the verification of the Vector of Unions passed</returns>
|
||||
// (this method is used internally by generated verification functions)
|
||||
public bool VerifyVectorOfUnion(uint tablePos, short typeOffsetId, short offsetId, VerifyUnionAction verifyAction, bool required)
|
||||
{
|
||||
// type id offset must be valid
|
||||
var offset = GetVOffset(tablePos, typeOffsetId);
|
||||
if (offset == 0)
|
||||
{
|
||||
return !required;
|
||||
}
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Get type id table absolute offset
|
||||
var typeIdVectorOffset = GetIndirectOffset(offset);
|
||||
// values offset must be valid
|
||||
offset = GetVOffset(tablePos, offsetId);
|
||||
if (!CheckIndirectOffset(offset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var valueVectorOffset = GetIndirectOffset(offset);
|
||||
// validate referenced vectors
|
||||
if(!CheckVector(typeIdVectorOffset, SIZE_BYTE) ||
|
||||
!CheckVector(valueVectorOffset, SIZE_U_OFFSET))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Both vectors should have the same length
|
||||
var typeIdVectorLength = ReadUOffsetT(verifier_buffer, typeIdVectorOffset);
|
||||
var valueVectorLength = ReadUOffsetT(verifier_buffer, valueVectorOffset);
|
||||
if (typeIdVectorLength != valueVectorLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Verify each union from vectors
|
||||
var typeIdStart = typeIdVectorOffset + SIZE_U_OFFSET;
|
||||
var valueStart = valueVectorOffset + SIZE_U_OFFSET;
|
||||
for (uint i = 0; i < typeIdVectorLength; i++)
|
||||
{
|
||||
// Get type id
|
||||
byte typeId = verifier_buffer.Get(Convert.ToInt32(typeIdStart + i * SIZE_U_OFFSET));
|
||||
// get offset to vector item
|
||||
uint off = valueStart + i * SIZE_U_OFFSET;
|
||||
// Check the vector item has a proper offset
|
||||
if (!CheckIndirectOffset(off))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint valueOffset = GetIndirectOffset(off);
|
||||
// Verify object
|
||||
if (!verifyAction(this, typeId, valueOffset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method verifies flatbuffer data using generated Table verification function.
|
||||
// The data buffer is already provided when creating [Verifier] object (see [NewVerifier])
|
||||
//
|
||||
// - identifier - the expected identifier of buffer data.
|
||||
// When empty identifier is provided the identifier validation is skipped.
|
||||
// - sizePrefixed - this flag should be true when buffer is prefixed with content size
|
||||
// - verifyObjFunc - function to be used for verification. This function is generated by compiler and included in each table definition file with name "<Tablename>Verify"
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// /* Verify Monster table. Ignore buffer name and assume buffer does not contain data length prefix */
|
||||
// isValid = verifier.verifyBuffer(bb, false, MonsterVerify)
|
||||
//
|
||||
// /* Verify Monster table. Buffer name is 'MONS' and contains data length prefix */
|
||||
// isValid = verifier.verifyBuffer("MONS", true, MonsterVerify)
|
||||
/// <summary> Method verifies flatbuffer data using generated Table verification function </summary>
|
||||
///
|
||||
/// <param name="identifier"> The expected identifier of buffer data</param>
|
||||
/// <param name="sizePrefixed"> Flag should be true when buffer is prefixed with content size</param>
|
||||
/// <param name="verifyAction"> Function to be used for verification. This function is generated by compiler and included in each table definition file</param>
|
||||
/// <returns> Return True when verification of FlatBuffer passed</returns>
|
||||
/// <example>
|
||||
/// Example 1. Verify Monster table. Ignore buffer name and assume buffer does not contain data length prefix
|
||||
/// <code> isValid = verifier.VerifyBuffer(bb, false, MonsterVerify)</code>
|
||||
/// Example 2. Verify Monster table. Buffer name is 'MONS' and contains data length prefix
|
||||
/// <code> isValid = verifier.VerifyBuffer("MONS", true, MonsterVerify)</code>
|
||||
/// </example>
|
||||
public bool VerifyBuffer(string identifier, bool sizePrefixed, VerifyTableAction verifyAction)
|
||||
{
|
||||
// Reset counters - starting verification from beginning
|
||||
depth = 0;
|
||||
numTables = 0;
|
||||
|
||||
var start = (uint)(verifier_buffer.Position);
|
||||
if (sizePrefixed)
|
||||
{
|
||||
start = (uint)(verifier_buffer.Position) + SIZE_PREFIX_LENGTH;
|
||||
if(!CheckScalar((uint)(verifier_buffer.Position), SIZE_PREFIX_LENGTH))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint size = ReadUOffsetT(verifier_buffer, (uint)(verifier_buffer.Position));
|
||||
if (size != ((uint)(verifier_buffer.Length) - start))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return CheckBufferFromStart(identifier, start, verifyAction);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/FlatBuffers/FlatBufferVerify.cs.meta
Normal file
11
Assets/FlatBuffers/FlatBufferVerify.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0a835f961ca44c9eb0a62443b92f9f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/FlatBuffers/IFlatbufferObject.cs
Normal file
28
Assets/FlatBuffers/IFlatbufferObject.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Google.FlatBuffers
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the base for both structs and tables.
|
||||
/// </summary>
|
||||
public interface IFlatbufferObject
|
||||
{
|
||||
void __init(int _i, ByteBuffer _bb);
|
||||
|
||||
ByteBuffer ByteBuffer { get; }
|
||||
}
|
||||
}
|
||||
11
Assets/FlatBuffers/IFlatbufferObject.cs.meta
Normal file
11
Assets/FlatBuffers/IFlatbufferObject.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2821ac5baad9e40f590495148a5df41f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
Assets/FlatBuffers/Offset.cs
Normal file
48
Assets/FlatBuffers/Offset.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Google.FlatBuffers
|
||||
{
|
||||
/// <summary>
|
||||
/// Offset class for typesafe assignments.
|
||||
/// </summary>
|
||||
public struct Offset<T> where T : struct
|
||||
{
|
||||
public int Value;
|
||||
public Offset(int value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct StringOffset
|
||||
{
|
||||
public int Value;
|
||||
public StringOffset(int value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct VectorOffset
|
||||
{
|
||||
public int Value;
|
||||
public VectorOffset(int value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/FlatBuffers/Offset.cs.meta
Normal file
11
Assets/FlatBuffers/Offset.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cfb5934e8bc74ce29583a1c4dac3f9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/FlatBuffers/Struct.cs
Normal file
34
Assets/FlatBuffers/Struct.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Google.FlatBuffers
|
||||
{
|
||||
/// <summary>
|
||||
/// All structs in the generated code derive from this class, and add their own accessors.
|
||||
/// </summary>
|
||||
public struct Struct
|
||||
{
|
||||
public int bb_pos { get; private set; }
|
||||
public ByteBuffer bb { get; private set; }
|
||||
|
||||
// Re-init the internal state with an external buffer {@code ByteBuffer} and an offset within.
|
||||
public Struct(int _i, ByteBuffer _bb) : this()
|
||||
{
|
||||
bb = _bb;
|
||||
bb_pos = _i;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/FlatBuffers/Struct.cs.meta
Normal file
11
Assets/FlatBuffers/Struct.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 638a3566fe0604c139b56de0118658e1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
212
Assets/FlatBuffers/Table.cs
Normal file
212
Assets/FlatBuffers/Table.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Google.FlatBuffers
|
||||
{
|
||||
/// <summary>
|
||||
/// All tables in the generated code derive from this struct, and add their own accessors.
|
||||
/// </summary>
|
||||
public struct Table
|
||||
{
|
||||
public int bb_pos { get; private set; }
|
||||
public ByteBuffer bb { get; private set; }
|
||||
|
||||
public ByteBuffer ByteBuffer { get { return bb; } }
|
||||
|
||||
// Re-init the internal state with an external buffer {@code ByteBuffer} and an offset within.
|
||||
public Table(int _i, ByteBuffer _bb) : this()
|
||||
{
|
||||
bb = _bb;
|
||||
bb_pos = _i;
|
||||
}
|
||||
|
||||
// Look up a field in the vtable, return an offset into the object, or 0 if the field is not
|
||||
// present.
|
||||
public int __offset(int vtableOffset)
|
||||
{
|
||||
int vtable = bb_pos - bb.GetInt(bb_pos);
|
||||
return vtableOffset < bb.GetShort(vtable) ? (int)bb.GetShort(vtable + vtableOffset) : 0;
|
||||
}
|
||||
|
||||
public static int __offset(int vtableOffset, int offset, ByteBuffer bb)
|
||||
{
|
||||
int vtable = bb.Length - offset;
|
||||
return (int)bb.GetShort(vtable + vtableOffset - bb.GetInt(vtable)) + vtable;
|
||||
}
|
||||
|
||||
// Retrieve the relative offset stored at "offset"
|
||||
public int __indirect(int offset)
|
||||
{
|
||||
return offset + bb.GetInt(offset);
|
||||
}
|
||||
|
||||
public static int __indirect(int offset, ByteBuffer bb)
|
||||
{
|
||||
return offset + bb.GetInt(offset);
|
||||
}
|
||||
|
||||
// Create a .NET String from UTF-8 data stored inside the flatbuffer.
|
||||
public string __string(int offset)
|
||||
{
|
||||
int stringOffset = bb.GetInt(offset);
|
||||
if (stringOffset == 0)
|
||||
return null;
|
||||
|
||||
offset += stringOffset;
|
||||
var len = bb.GetInt(offset);
|
||||
var startPos = offset + sizeof(int);
|
||||
return bb.GetStringUTF8(startPos, len);
|
||||
}
|
||||
|
||||
// Get the length of a vector whose offset is stored at "offset" in this object.
|
||||
public int __vector_len(int offset)
|
||||
{
|
||||
offset += bb_pos;
|
||||
offset += bb.GetInt(offset);
|
||||
return bb.GetInt(offset);
|
||||
}
|
||||
|
||||
// Get the start of data of a vector whose offset is stored at "offset" in this object.
|
||||
public int __vector(int offset)
|
||||
{
|
||||
offset += bb_pos;
|
||||
return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length
|
||||
}
|
||||
|
||||
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
|
||||
// Get the data of a vector whoses offset is stored at "offset" in this object as an
|
||||
// Spant<byte>. If the vector is not present in the ByteBuffer,
|
||||
// then an empty span will be returned.
|
||||
public Span<T> __vector_as_span<T>(int offset, int elementSize) where T : struct
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
throw new NotSupportedException("Getting typed span on a Big Endian " +
|
||||
"system is not support");
|
||||
}
|
||||
|
||||
var o = this.__offset(offset);
|
||||
if (0 == o)
|
||||
{
|
||||
return new Span<T>();
|
||||
}
|
||||
|
||||
var pos = this.__vector(o);
|
||||
var len = this.__vector_len(o);
|
||||
return MemoryMarshal.Cast<byte, T>(bb.ToSpan(pos, len * elementSize));
|
||||
}
|
||||
#else
|
||||
// Get the data of a vector whoses offset is stored at "offset" in this object as an
|
||||
// ArraySegment<byte>. If the vector is not present in the ByteBuffer,
|
||||
// then a null value will be returned.
|
||||
public ArraySegment<byte>? __vector_as_arraysegment(int offset)
|
||||
{
|
||||
var o = this.__offset(offset);
|
||||
if (0 == o)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var pos = this.__vector(o);
|
||||
var len = this.__vector_len(o);
|
||||
return bb.ToArraySegment(pos, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the data of a vector whoses offset is stored at "offset" in this object as an
|
||||
// T[]. If the vector is not present in the ByteBuffer, then a null value will be
|
||||
// returned.
|
||||
public T[] __vector_as_array<T>(int offset)
|
||||
where T : struct
|
||||
{
|
||||
if(!BitConverter.IsLittleEndian)
|
||||
{
|
||||
throw new NotSupportedException("Getting typed arrays on a Big Endian " +
|
||||
"system is not support");
|
||||
}
|
||||
|
||||
var o = this.__offset(offset);
|
||||
if (0 == o)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var pos = this.__vector(o);
|
||||
var len = this.__vector_len(o);
|
||||
return bb.ToArray<T>(pos, len);
|
||||
}
|
||||
|
||||
// Initialize any Table-derived type to point to the union at the given offset.
|
||||
public T __union<T>(int offset) where T : struct, IFlatbufferObject
|
||||
{
|
||||
T t = new T();
|
||||
t.__init(__indirect(offset), bb);
|
||||
return t;
|
||||
}
|
||||
|
||||
public static bool __has_identifier(ByteBuffer bb, string ident)
|
||||
{
|
||||
if (ident.Length != FlatBufferConstants.FileIdentifierLength)
|
||||
throw new ArgumentException("FlatBuffers: file identifier must be length " + FlatBufferConstants.FileIdentifierLength, "ident");
|
||||
|
||||
for (var i = 0; i < FlatBufferConstants.FileIdentifierLength; i++)
|
||||
{
|
||||
if (ident[i] != (char)bb.Get(bb.Position + sizeof(int) + i)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Compare strings in the ByteBuffer.
|
||||
public static int CompareStrings(int offset_1, int offset_2, ByteBuffer bb)
|
||||
{
|
||||
offset_1 += bb.GetInt(offset_1);
|
||||
offset_2 += bb.GetInt(offset_2);
|
||||
var len_1 = bb.GetInt(offset_1);
|
||||
var len_2 = bb.GetInt(offset_2);
|
||||
var startPos_1 = offset_1 + sizeof(int);
|
||||
var startPos_2 = offset_2 + sizeof(int);
|
||||
var len = Math.Min(len_1, len_2);
|
||||
for(int i = 0; i < len; i++) {
|
||||
byte b1 = bb.Get(i + startPos_1);
|
||||
byte b2 = bb.Get(i + startPos_2);
|
||||
if (b1 != b2)
|
||||
return b1 - b2;
|
||||
}
|
||||
return len_1 - len_2;
|
||||
}
|
||||
|
||||
// Compare string from the ByteBuffer with the string object
|
||||
public static int CompareStrings(int offset_1, byte[] key, ByteBuffer bb)
|
||||
{
|
||||
offset_1 += bb.GetInt(offset_1);
|
||||
var len_1 = bb.GetInt(offset_1);
|
||||
var len_2 = key.Length;
|
||||
var startPos_1 = offset_1 + sizeof(int);
|
||||
var len = Math.Min(len_1, len_2);
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte b = bb.Get(i + startPos_1);
|
||||
if (b != key[i])
|
||||
return b - key[i];
|
||||
}
|
||||
return len_1 - len_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/FlatBuffers/Table.cs.meta
Normal file
11
Assets/FlatBuffers/Table.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 494155ae1a6dd4112a7e9331f74155d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlatBuffers/flatbuffers.png
Normal file
BIN
Assets/FlatBuffers/flatbuffers.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
114
Assets/FlatBuffers/flatbuffers.png.meta
Normal file
114
Assets/FlatBuffers/flatbuffers.png.meta
Normal file
@@ -0,0 +1,114 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6ae6bb982bc3468aa1af22a7aa4c7b7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlatBuffers/flatbuffers.snk
Normal file
BIN
Assets/FlatBuffers/flatbuffers.snk
Normal file
Binary file not shown.
7
Assets/FlatBuffers/flatbuffers.snk.meta
Normal file
7
Assets/FlatBuffers/flatbuffers.snk.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b81e3ed71ec546ac912b1d543b92917
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Flatbuffers_generated.meta
Normal file
8
Assets/Flatbuffers_generated.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63dc34047e5ea41b19a003c74c03b744
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
72
Assets/Flatbuffers_generated/ModuleConnection.cs
Normal file
72
Assets/Flatbuffers_generated/ModuleConnection.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace Frontend
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct ModuleConnection : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { }
|
||||
public static ModuleConnection GetRootAsModuleConnection(ByteBuffer _bb) { return GetRootAsModuleConnection(_bb, new ModuleConnection()); }
|
||||
public static ModuleConnection GetRootAsModuleConnection(ByteBuffer _bb, ModuleConnection obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public ModuleConnection __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public byte FromModuleId { get { int o = __p.__offset(4); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
|
||||
public byte ToModuleId { get { int o = __p.__offset(6); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
|
||||
public byte FromSocket { get { int o = __p.__offset(8); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
|
||||
public byte ToSocket { get { int o = __p.__offset(10); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
|
||||
public Orientation Orientation { get { int o = __p.__offset(12); return o != 0 ? (Orientation)__p.bb.GetSbyte(o + __p.bb_pos) : Orientation.Deg0; } }
|
||||
|
||||
public static Offset<Frontend.ModuleConnection> CreateModuleConnection(FlatBufferBuilder builder,
|
||||
byte from_module_id = 0,
|
||||
byte to_module_id = 0,
|
||||
byte from_socket = 0,
|
||||
byte to_socket = 0,
|
||||
Orientation orientation = Orientation.Deg0)
|
||||
{
|
||||
builder.StartTable(5);
|
||||
ModuleConnection.AddOrientation(builder, orientation);
|
||||
ModuleConnection.AddToSocket(builder, to_socket);
|
||||
ModuleConnection.AddFromSocket(builder, from_socket);
|
||||
ModuleConnection.AddToModuleId(builder, to_module_id);
|
||||
ModuleConnection.AddFromModuleId(builder, from_module_id);
|
||||
return ModuleConnection.EndModuleConnection(builder);
|
||||
}
|
||||
|
||||
public static void StartModuleConnection(FlatBufferBuilder builder) { builder.StartTable(5); }
|
||||
public static void AddFromModuleId(FlatBufferBuilder builder, byte fromModuleId) { builder.AddByte(0, fromModuleId, 0); }
|
||||
public static void AddToModuleId(FlatBufferBuilder builder, byte toModuleId) { builder.AddByte(1, toModuleId, 0); }
|
||||
public static void AddFromSocket(FlatBufferBuilder builder, byte fromSocket) { builder.AddByte(2, fromSocket, 0); }
|
||||
public static void AddToSocket(FlatBufferBuilder builder, byte toSocket) { builder.AddByte(3, toSocket, 0); }
|
||||
public static void AddOrientation(FlatBufferBuilder builder, Orientation orientation) { builder.AddSbyte(4, (sbyte)orientation, 0); }
|
||||
public static Offset<Frontend.ModuleConnection> EndModuleConnection(FlatBufferBuilder builder)
|
||||
{
|
||||
int o = builder.EndTable();
|
||||
return new Offset<Frontend.ModuleConnection>(o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class ModuleConnectionVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyField(tablePos, 4 /*FromModuleId*/, 1 /*byte*/, 1, false)
|
||||
&& verifier.VerifyField(tablePos, 6 /*ToModuleId*/, 1 /*byte*/, 1, false)
|
||||
&& verifier.VerifyField(tablePos, 8 /*FromSocket*/, 1 /*byte*/, 1, false)
|
||||
&& verifier.VerifyField(tablePos, 10 /*ToSocket*/, 1 /*byte*/, 1, false)
|
||||
&& verifier.VerifyField(tablePos, 12 /*Orientation*/, 1 /*Orientation*/, 1, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Flatbuffers_generated/ModuleConnection.cs.meta
Normal file
11
Assets/Flatbuffers_generated/ModuleConnection.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d201b6450d0e4cbe90f5b5786daaa13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Assets/Flatbuffers_generated/ModuleState.cs
Normal file
29
Assets/Flatbuffers_generated/ModuleState.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
public enum ModuleState : byte
|
||||
{
|
||||
NONE = 0,
|
||||
MotorState = 1,
|
||||
};
|
||||
|
||||
|
||||
|
||||
static public class ModuleStateVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, byte typeId, uint tablePos)
|
||||
{
|
||||
bool result = true;
|
||||
switch((ModuleState)typeId)
|
||||
{
|
||||
case ModuleState.MotorState:
|
||||
result = MotorStateVerify.Verify(verifier, tablePos);
|
||||
break;
|
||||
default: result = true;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Flatbuffers_generated/ModuleState.cs.meta
Normal file
11
Assets/Flatbuffers_generated/ModuleState.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3c28324e9ccf417ca5c3ec7520c2c1a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
Assets/Flatbuffers_generated/ModuleType.cs
Normal file
13
Assets/Flatbuffers_generated/ModuleType.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
public enum ModuleType : sbyte
|
||||
{
|
||||
SPLITTER = 0,
|
||||
SERVO_1 = 1,
|
||||
DC_MOTOR = 2,
|
||||
BATTERY = 3,
|
||||
SERVO_2 = 4,
|
||||
};
|
||||
|
||||
11
Assets/Flatbuffers_generated/ModuleType.cs.meta
Normal file
11
Assets/Flatbuffers_generated/ModuleType.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ef40cf043e624e82813974f777d40a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
45
Assets/Flatbuffers_generated/MotorState.cs
Normal file
45
Assets/Flatbuffers_generated/MotorState.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct MotorState : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { }
|
||||
public static MotorState GetRootAsMotorState(ByteBuffer _bb) { return GetRootAsMotorState(_bb, new MotorState()); }
|
||||
public static MotorState GetRootAsMotorState(ByteBuffer _bb, MotorState obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public MotorState __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public int Angle { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
|
||||
|
||||
public static Offset<MotorState> CreateMotorState(FlatBufferBuilder builder,
|
||||
int angle = 0) {
|
||||
builder.StartTable(1);
|
||||
MotorState.AddAngle(builder, angle);
|
||||
return MotorState.EndMotorState(builder);
|
||||
}
|
||||
|
||||
public static void StartMotorState(FlatBufferBuilder builder) { builder.StartTable(1); }
|
||||
public static void AddAngle(FlatBufferBuilder builder, int angle) { builder.AddInt(0, angle, 0); }
|
||||
public static Offset<MotorState> EndMotorState(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<MotorState>(o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public class MotorStateVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyField(tablePos, 4 /*Angle*/, 4 /*int*/, 4, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
11
Assets/Flatbuffers_generated/MotorState.cs.meta
Normal file
11
Assets/Flatbuffers_generated/MotorState.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f0cb4d63336340b0bf2110db7c128e5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/Flatbuffers_generated/Orientation.cs
Normal file
12
Assets/Flatbuffers_generated/Orientation.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
public enum Orientation : sbyte
|
||||
{
|
||||
Deg0 = 0,
|
||||
Deg90 = 1,
|
||||
Deg180 = 2,
|
||||
Deg270 = 3,
|
||||
};
|
||||
|
||||
11
Assets/Flatbuffers_generated/Orientation.cs.meta
Normal file
11
Assets/Flatbuffers_generated/Orientation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac2a8fe501a9f45eab3d37011d76deca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
70
Assets/Flatbuffers_generated/RobotConfiguration.cs
Normal file
70
Assets/Flatbuffers_generated/RobotConfiguration.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace Frontend
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct RobotConfiguration : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { }
|
||||
public static RobotConfiguration GetRootAsRobotConfiguration(ByteBuffer _bb) { return GetRootAsRobotConfiguration(_bb, new RobotConfiguration()); }
|
||||
public static RobotConfiguration GetRootAsRobotConfiguration(ByteBuffer _bb, RobotConfiguration obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public static bool VerifyRobotConfiguration(ByteBuffer _bb) {Google.FlatBuffers.Verifier verifier = new Google.FlatBuffers.Verifier(_bb); return verifier.VerifyBuffer("", false, RobotConfigurationVerify.Verify); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public RobotConfiguration __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public RobotModule? Modules(int j) { int o = __p.__offset(4); return o != 0 ? (RobotModule?)(new RobotModule()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; }
|
||||
public int ModulesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
public Frontend.ModuleConnection? Connections(int j) { int o = __p.__offset(6); return o != 0 ? (Frontend.ModuleConnection?)(new Frontend.ModuleConnection()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; }
|
||||
public int ConnectionsLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
|
||||
public static Offset<Frontend.RobotConfiguration> CreateRobotConfiguration(FlatBufferBuilder builder,
|
||||
VectorOffset modulesOffset = default(VectorOffset),
|
||||
VectorOffset connectionsOffset = default(VectorOffset)) {
|
||||
builder.StartTable(2);
|
||||
RobotConfiguration.AddConnections(builder, connectionsOffset);
|
||||
RobotConfiguration.AddModules(builder, modulesOffset);
|
||||
return RobotConfiguration.EndRobotConfiguration(builder);
|
||||
}
|
||||
|
||||
public static void StartRobotConfiguration(FlatBufferBuilder builder) { builder.StartTable(2); }
|
||||
public static void AddModules(FlatBufferBuilder builder, VectorOffset modulesOffset) { builder.AddOffset(0, modulesOffset.Value, 0); }
|
||||
public static VectorOffset CreateModulesVector(FlatBufferBuilder builder, Offset<RobotModule>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
|
||||
public static VectorOffset CreateModulesVectorBlock(FlatBufferBuilder builder, Offset<RobotModule>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
|
||||
public static VectorOffset CreateModulesVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<RobotModule>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
|
||||
public static VectorOffset CreateModulesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<RobotModule>>(dataPtr, sizeInBytes); return builder.EndVector(); }
|
||||
public static void StartModulesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
|
||||
public static void AddConnections(FlatBufferBuilder builder, VectorOffset connectionsOffset) { builder.AddOffset(1, connectionsOffset.Value, 0); }
|
||||
public static VectorOffset CreateConnectionsVector(FlatBufferBuilder builder, Offset<Frontend.ModuleConnection>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
|
||||
public static VectorOffset CreateConnectionsVectorBlock(FlatBufferBuilder builder, Offset<Frontend.ModuleConnection>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
|
||||
public static VectorOffset CreateConnectionsVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<Frontend.ModuleConnection>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
|
||||
public static VectorOffset CreateConnectionsVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<Frontend.ModuleConnection>>(dataPtr, sizeInBytes); return builder.EndVector(); }
|
||||
public static void StartConnectionsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
|
||||
public static Offset<Frontend.RobotConfiguration> EndRobotConfiguration(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<Frontend.RobotConfiguration>(o);
|
||||
}
|
||||
public static void FinishRobotConfigurationBuffer(FlatBufferBuilder builder, Offset<Frontend.RobotConfiguration> offset) { builder.Finish(offset.Value); }
|
||||
public static void FinishSizePrefixedRobotConfigurationBuffer(FlatBufferBuilder builder, Offset<Frontend.RobotConfiguration> offset) { builder.FinishSizePrefixed(offset.Value); }
|
||||
}
|
||||
|
||||
|
||||
static public class RobotConfigurationVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyVectorOfTables(tablePos, 4 /*Modules*/, RobotModuleVerify.Verify, false)
|
||||
&& verifier.VerifyVectorOfTables(tablePos, 6 /*Connections*/, Frontend.ModuleConnectionVerify.Verify, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Flatbuffers_generated/RobotConfiguration.cs.meta
Normal file
11
Assets/Flatbuffers_generated/RobotConfiguration.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82e7cacf483fc4a41b65c8fdda5c8839
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
Assets/Flatbuffers_generated/RobotModule.cs
Normal file
64
Assets/Flatbuffers_generated/RobotModule.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
using global::System;
|
||||
using global::System.Collections.Generic;
|
||||
using global::Google.FlatBuffers;
|
||||
|
||||
public struct RobotModule : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static void ValidateVersion() { }
|
||||
public static RobotModule GetRootAsRobotModule(ByteBuffer _bb) { return GetRootAsRobotModule(_bb, new RobotModule()); }
|
||||
public static RobotModule GetRootAsRobotModule(ByteBuffer _bb, RobotModule obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public static bool VerifyRobotModule(ByteBuffer _bb) {Google.FlatBuffers.Verifier verifier = new Google.FlatBuffers.Verifier(_bb); return verifier.VerifyBuffer("", false, RobotModuleVerify.Verify); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
|
||||
public RobotModule __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public byte Id { get { int o = __p.__offset(4); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
|
||||
public ModuleType ModuleType { get { int o = __p.__offset(6); return o != 0 ? (ModuleType)__p.bb.GetSbyte(o + __p.bb_pos) : ModuleType.SPLITTER; } }
|
||||
public ModuleState ConfigurationType { get { int o = __p.__offset(8); return o != 0 ? (ModuleState)__p.bb.Get(o + __p.bb_pos) : ModuleState.NONE; } }
|
||||
public TTable? Configuration<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(10); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
|
||||
public MotorState ConfigurationAsMotorState() { return Configuration<MotorState>().Value; }
|
||||
|
||||
public static Offset<RobotModule> CreateRobotModule(FlatBufferBuilder builder,
|
||||
byte id = 0,
|
||||
ModuleType module_type = ModuleType.SPLITTER,
|
||||
ModuleState configuration_type = ModuleState.NONE,
|
||||
int configurationOffset = 0) {
|
||||
builder.StartTable(4);
|
||||
RobotModule.AddConfiguration(builder, configurationOffset);
|
||||
RobotModule.AddConfigurationType(builder, configuration_type);
|
||||
RobotModule.AddModuleType(builder, module_type);
|
||||
RobotModule.AddId(builder, id);
|
||||
return RobotModule.EndRobotModule(builder);
|
||||
}
|
||||
|
||||
public static void StartRobotModule(FlatBufferBuilder builder) { builder.StartTable(4); }
|
||||
public static void AddId(FlatBufferBuilder builder, byte id) { builder.AddByte(0, id, 0); }
|
||||
public static void AddModuleType(FlatBufferBuilder builder, ModuleType moduleType) { builder.AddSbyte(1, (sbyte)moduleType, 0); }
|
||||
public static void AddConfigurationType(FlatBufferBuilder builder, ModuleState configurationType) { builder.AddByte(2, (byte)configurationType, 0); }
|
||||
public static void AddConfiguration(FlatBufferBuilder builder, int configurationOffset) { builder.AddOffset(3, configurationOffset, 0); }
|
||||
public static Offset<RobotModule> EndRobotModule(FlatBufferBuilder builder) {
|
||||
int o = builder.EndTable();
|
||||
return new Offset<RobotModule>(o);
|
||||
}
|
||||
public static void FinishRobotModuleBuffer(FlatBufferBuilder builder, Offset<RobotModule> offset) { builder.Finish(offset.Value); }
|
||||
public static void FinishSizePrefixedRobotModuleBuffer(FlatBufferBuilder builder, Offset<RobotModule> offset) { builder.FinishSizePrefixed(offset.Value); }
|
||||
}
|
||||
|
||||
|
||||
static public class RobotModuleVerify
|
||||
{
|
||||
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
|
||||
{
|
||||
return verifier.VerifyTableStart(tablePos)
|
||||
&& verifier.VerifyField(tablePos, 4 /*Id*/, 1 /*byte*/, 1, false)
|
||||
&& verifier.VerifyField(tablePos, 6 /*ModuleType*/, 1 /*ModuleType*/, 1, false)
|
||||
&& verifier.VerifyField(tablePos, 8 /*ConfigurationType*/, 1 /*ModuleState*/, 1, false)
|
||||
&& verifier.VerifyUnion(tablePos, 8, 10 /*Configuration*/, ModuleStateVerify.Verify, false)
|
||||
&& verifier.VerifyTableEnd(tablePos);
|
||||
}
|
||||
}
|
||||
11
Assets/Flatbuffers_generated/RobotModule.cs.meta
Normal file
11
Assets/Flatbuffers_generated/RobotModule.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e1dfa9e19cd24fb580b2840d514b983
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Assets/IdentifyModule.cs
Normal file
58
Assets/IdentifyModule.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class IdentifyModule : MonoBehaviour
|
||||
{
|
||||
|
||||
private bool IsPointerOverUI()
|
||||
{
|
||||
return EventSystem.current != null && EventSystem.current.IsPointerOverGameObject();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0)) // Left click
|
||||
{
|
||||
if (IsPointerOverUI()) return;
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
if (Physics.Raycast(ray, out RaycastHit hit))
|
||||
{
|
||||
//ServoBendModule hitModule = hit.transform.GetComponent<ServoBendModule>();
|
||||
ServoMotorModule hitModule = hit.collider.GetComponent<ServoMotorModule>();
|
||||
|
||||
if (hitModule != null)
|
||||
{
|
||||
// if (ServoBendModule.selectedModule != null && ServoBendModule.selectedModule != hitModule)
|
||||
// {
|
||||
// ServoBendModule.selectedModule.SetHighlight(false);
|
||||
// }
|
||||
|
||||
ServoMotorModule.selectedModule = hitModule;
|
||||
// hitModule.SetHighlight(true);
|
||||
Debug.Log($"Selected: {hitModule.name}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clicked something else
|
||||
if (ServoMotorModule.selectedModule != null)
|
||||
{
|
||||
// ServoBendModule.selectedModule.SetHighlight(false);
|
||||
ServoMotorModule.selectedModule = null;
|
||||
// Debug.Log("Deselected module (clicked non-module object).");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clicked empty space
|
||||
if (ServoMotorModule.selectedModule != null)
|
||||
{
|
||||
// ServoBendModule.selectedModule.SetHighlight(false);
|
||||
ServoMotorModule.selectedModule = null;
|
||||
Debug.Log("Deselected module (clicked empty space).");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/IdentifyModule.cs.meta
Normal file
11
Assets/IdentifyModule.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7183a4f096e7481b9079478193d04a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Module.meta
Normal file
8
Assets/Module.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a54aeb95e5064b0b9d95ed758ac88e3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Module/.DS_Store
vendored
Normal file
BIN
Assets/Module/.DS_Store
vendored
Normal file
Binary file not shown.
19
Assets/Module/AngleChangeModel.cs
Normal file
19
Assets/Module/AngleChangeModel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[System.Serializable]
|
||||
public class ServoCommand
|
||||
{
|
||||
public string ModuleId;
|
||||
public string Type = "Servo";
|
||||
public float TargetAngle;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class DCCommand
|
||||
{
|
||||
public string ModuleId;
|
||||
public string Type = "DC";
|
||||
public float RotateByDegrees;
|
||||
public string Direction; // "Clockwise" or "CounterClockwise"
|
||||
}
|
||||
11
Assets/Module/AngleChangeModel.cs.meta
Normal file
11
Assets/Module/AngleChangeModel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af0f000a0b89940f5add4d41e75c5ab6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Module/BatteryModule.cs
Normal file
9
Assets/Module/BatteryModule.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BatteryModule : ModuleBase
|
||||
{
|
||||
public override void OnSelect() { }
|
||||
public override void DeSelect() { }
|
||||
}
|
||||
11
Assets/Module/BatteryModule.cs.meta
Normal file
11
Assets/Module/BatteryModule.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0d44e50b94d44bf6b87f9db5a07981c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
292
Assets/Module/DCActualFinal.prefab
Normal file
292
Assets/Module/DCActualFinal.prefab
Normal file
@@ -0,0 +1,292 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3292419760055380793
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1035619184240433839}
|
||||
m_Layer: 0
|
||||
m_Name: FemaleSocket
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1035619184240433839
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3292419760055380793}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.010896653, y: -0.010896653, z: 0.7070228, w: 0.70702285}
|
||||
m_LocalPosition: {x: 0.00030999756, y: -0.050009932, z: -0.0014218215}
|
||||
m_LocalScale: {x: 0.049999997, y: 0.049999997, z: 0.05}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8999369412263894087}
|
||||
m_LocalEulerAnglesHint: {x: -90, y: 180, z: -90}
|
||||
--- !u!1 &6583802801347580299
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3944779462805450}
|
||||
- component: {fileID: 2558294313116166637}
|
||||
- component: {fileID: 7264553181683981478}
|
||||
- component: {fileID: 182848113984496985}
|
||||
m_Layer: 0
|
||||
m_Name: MotorShaft
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3944779462805450
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6583802801347580299}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.005, z: 0}
|
||||
m_LocalScale: {x: 0.0025, y: 0.02, z: 0.0025}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8999369412263894087}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &2558294313116166637
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6583802801347580299}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &7264553181683981478
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6583802801347580299}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 5a9603aa200ca0c45bf4ce1b20e1a39a, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &182848113984496985
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6583802801347580299}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1.0807759, y: 0.747985, z: 1}
|
||||
m_Center: {x: 0.04038785, y: 0.12600818, z: 0}
|
||||
--- !u!1 &7364692261245862742
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8999369412263894087}
|
||||
- component: {fileID: 9210502650637947267}
|
||||
m_Layer: 0
|
||||
m_Name: DCActualFinal
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8999369412263894087
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7364692261245862742}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.7069807, y: -0.7070592, z: -0.012243745, w: 0.009781737}
|
||||
m_LocalPosition: {x: -3.9, y: 0.28, z: -2.95}
|
||||
m_LocalScale: {x: 20, y: 20, z: 20}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3944779462805450}
|
||||
- {fileID: 3643797692257417748}
|
||||
- {fileID: 1035619184240433839}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 180.2, y: 1.7850037, z: 90.003}
|
||||
--- !u!114 &9210502650637947267
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7364692261245862742}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 010a1e64e11ea4ea48068fa4ba025b46, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
motorShaft: {fileID: 3944779462805450}
|
||||
rotationSpeed: 90
|
||||
--- !u!1 &8274056087524456700
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3643797692257417748}
|
||||
- component: {fileID: 6921473037880860075}
|
||||
- component: {fileID: 5298970936615407170}
|
||||
- component: {fileID: 8075788923889194193}
|
||||
m_Layer: 0
|
||||
m_Name: DCMotorBody
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3643797692257417748
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8274056087524456700}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.71791947, y: -0, z: -0, w: 0.69612616}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 10, z: 10}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8999369412263894087}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &6921473037880860075
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8274056087524456700}
|
||||
m_Mesh: {fileID: 8604045607132181640, guid: 02370d6fa17f742f393ad699c6e30f40, type: 3}
|
||||
--- !u!23 &5298970936615407170
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8274056087524456700}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 7397659539795428015, guid: 02370d6fa17f742f393ad699c6e30f40, type: 3}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &8075788923889194193
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8274056087524456700}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.002819935, y: 0.0036000002, z: 0.0050528883}
|
||||
m_Center: {x: 0.000009967983, y: 7.777669e-12, z: 0.0024735613}
|
||||
7
Assets/Module/DCActualFinal.prefab.meta
Normal file
7
Assets/Module/DCActualFinal.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ffe98828f23843f4814a5dc44baaf85
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
260
Assets/Module/DCMotorModule.prefab
Normal file
260
Assets/Module/DCMotorModule.prefab
Normal file
@@ -0,0 +1,260 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &2019457865491779920
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2205902824370289416}
|
||||
- component: {fileID: 5170167143947308326}
|
||||
- component: {fileID: 1549954897902023943}
|
||||
- component: {fileID: 4911314022991483531}
|
||||
m_Layer: 0
|
||||
m_Name: MotorShaft
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2205902824370289416
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2019457865491779920}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.005, z: 0}
|
||||
m_LocalScale: {x: 0.0025, y: 0.02, z: 0.0025}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5278868739616043210}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5170167143947308326
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2019457865491779920}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1549954897902023943
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2019457865491779920}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 5a9603aa200ca0c45bf4ce1b20e1a39a, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &4911314022991483531
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2019457865491779920}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1.0807759, y: 0.747985, z: 1}
|
||||
m_Center: {x: 0.04038785, y: 0.12600818, z: 0}
|
||||
--- !u!1 &2958901227120055125
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3506715766167772924}
|
||||
- component: {fileID: 6489369990435455088}
|
||||
- component: {fileID: 2697430761330675283}
|
||||
- component: {fileID: 8326399252751671744}
|
||||
m_Layer: 0
|
||||
m_Name: DCMotorBody
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3506715766167772924
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2958901227120055125}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.71791947, y: -0, z: -0, w: 0.69612616}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 10, z: 10}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5278868739616043210}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &6489369990435455088
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2958901227120055125}
|
||||
m_Mesh: {fileID: 8604045607132181640, guid: 02370d6fa17f742f393ad699c6e30f40, type: 3}
|
||||
--- !u!23 &2697430761330675283
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2958901227120055125}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 7397659539795428015, guid: 02370d6fa17f742f393ad699c6e30f40, type: 3}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &8326399252751671744
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2958901227120055125}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.002819935, y: 0.0036000002, z: 0.0050528883}
|
||||
m_Center: {x: 0.000009967983, y: 7.777669e-12, z: 0.0024735613}
|
||||
--- !u!1 &3563533490444010952
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5278868739616043210}
|
||||
- component: {fileID: 8712259243222680207}
|
||||
m_Layer: 0
|
||||
m_Name: DCMotorModule
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5278868739616043210
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3563533490444010952}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.907, y: 0.304, z: -1.862}
|
||||
m_LocalScale: {x: 20, y: 20, z: 20}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2205902824370289416}
|
||||
- {fileID: 3506715766167772924}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &8712259243222680207
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3563533490444010952}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 010a1e64e11ea4ea48068fa4ba025b46, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
motorShaft: {fileID: 2205902824370289416}
|
||||
rotationSpeed: 90
|
||||
7
Assets/Module/DCMotorModule.prefab.meta
Normal file
7
Assets/Module/DCMotorModule.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7731927cf621844b6aad08f3b4f9e278
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Assets/Module/DCMotorModuleFinal.prefab
Normal file
71
Assets/Module/DCMotorModuleFinal.prefab
Normal file
@@ -0,0 +1,71 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &2755166691943480011
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3144005682151899204, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: DCMotorModuleFinal Variant
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0.25829834
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.3040734
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -1.3519248
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.009781737
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0.7069807
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0.7070592
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0.012243745
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 180.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 1.7850037
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6627662761486256073, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 90.003
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7425357433547079646, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.000031
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7425357433547079646, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.000012
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7425357433547079646, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0.005003
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: a5fae2277d0014f04abc97a6662ec89b, type: 3}
|
||||
7
Assets/Module/DCMotorModuleFinal.prefab.meta
Normal file
7
Assets/Module/DCMotorModuleFinal.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 697a2b8a9a497421e82b9fed7afa4798
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
292
Assets/Module/DCMotorOld.prefab
Normal file
292
Assets/Module/DCMotorOld.prefab
Normal file
@@ -0,0 +1,292 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1467126261888459679
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3232951914591476731}
|
||||
- component: {fileID: 6571457672642416589}
|
||||
- component: {fileID: 7550244084283555613}
|
||||
- component: {fileID: 3226239165173753503}
|
||||
m_Layer: 0
|
||||
m_Name: DCMotorBody
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3232951914591476731
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1467126261888459679}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.71791947, y: -0, z: -0, w: 0.69612616}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 10, z: 10}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7425357433547079646}
|
||||
m_Father: {fileID: 6627662761486256073}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &6571457672642416589
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1467126261888459679}
|
||||
m_Mesh: {fileID: 8604045607132181640, guid: 02370d6fa17f742f393ad699c6e30f40, type: 3}
|
||||
--- !u!23 &7550244084283555613
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1467126261888459679}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 7397659539795428015, guid: 02370d6fa17f742f393ad699c6e30f40, type: 3}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &3226239165173753503
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1467126261888459679}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.002819935, y: 0.0036000002, z: 0.0050528883}
|
||||
m_Center: {x: 0.000009967983, y: 7.777669e-12, z: 0.0024735613}
|
||||
--- !u!1 &3144005682151899204
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6627662761486256073}
|
||||
- component: {fileID: 610632699172388127}
|
||||
m_Layer: 0
|
||||
m_Name: DCMotorOld
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6627662761486256073
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3144005682151899204}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.7071068, y: -0.7071068, z: 0, w: 0}
|
||||
m_LocalPosition: {x: -0.258, y: 0.304, z: -1.272}
|
||||
m_LocalScale: {x: 20, y: 20, z: 20}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 5636511985024230804}
|
||||
- {fileID: 3232951914591476731}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 180, y: 0, z: 90}
|
||||
--- !u!114 &610632699172388127
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3144005682151899204}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 010a1e64e11ea4ea48068fa4ba025b46, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
motorShaft: {fileID: 5636511985024230804}
|
||||
rotationSpeed: 90
|
||||
--- !u!1 &4495798888270218818
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7425357433547079646}
|
||||
m_Layer: 0
|
||||
m_Name: BodySocket
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7425357433547079646
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4495798888270218818}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0.49223533, y: 0.49223533, z: 0.50764596, w: 0.50764596}
|
||||
m_LocalPosition: {x: 0.00008, y: 0.00009, z: 0.00507}
|
||||
m_LocalScale: {x: 0.005, y: 0.005, z: 0.005}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3232951914591476731}
|
||||
m_LocalEulerAnglesHint: {x: -91.766, y: 180, z: -90}
|
||||
--- !u!1 &7537172105070870413
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5636511985024230804}
|
||||
- component: {fileID: 5508900516591227585}
|
||||
- component: {fileID: 1413293439546090567}
|
||||
- component: {fileID: 7166894695426940597}
|
||||
m_Layer: 0
|
||||
m_Name: MotorShaft
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5636511985024230804
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7537172105070870413}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.005, z: 0}
|
||||
m_LocalScale: {x: 0.0025, y: 0.02, z: 0.0025}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6627662761486256073}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5508900516591227585
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7537172105070870413}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &1413293439546090567
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7537172105070870413}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 5a9603aa200ca0c45bf4ce1b20e1a39a, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &7166894695426940597
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7537172105070870413}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1.0807759, y: 0.747985, z: 1}
|
||||
m_Center: {x: 0.04038785, y: 0.12600818, z: 0}
|
||||
7
Assets/Module/DCMotorOld.prefab.meta
Normal file
7
Assets/Module/DCMotorOld.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5fae2277d0014f04abc97a6662ec89b
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
Assets/Module/DCNEWSOCKET.prefab
Normal file
79
Assets/Module/DCNEWSOCKET.prefab
Normal file
@@ -0,0 +1,79 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &7704966891293510062
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 981099726818392719, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: DCNEWSOCKET
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4697389362955306261, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4697389362955306261, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4697389362955306261, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4697389362955306261, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4697389362955306261, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: -90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0.25829834
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.3040734
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -1.3519248
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.009781737
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0.7069807
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0.7070592
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0.012243745
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 180.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 1.7850037
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9063038678325951746, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 90.003
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 697a2b8a9a497421e82b9fed7afa4798, type: 3}
|
||||
7
Assets/Module/DCNEWSOCKET.prefab.meta
Normal file
7
Assets/Module/DCNEWSOCKET.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f54eee4d6fe643ba98e080c86deb5d1
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Assets/Module/DiscoveryButton.cs
Normal file
30
Assets/Module/DiscoveryButton.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class DiscoveryButton : MonoBehaviour
|
||||
{
|
||||
public TopologyBuilder topologyBuilder;
|
||||
|
||||
void Start()
|
||||
{
|
||||
ControlLibrary.init(); // todo: where should this be? needs to be somewhere on startup of the game.
|
||||
}
|
||||
|
||||
public void OnDiscoveryPressed()
|
||||
{
|
||||
if (topologyBuilder != null)
|
||||
{
|
||||
Debug.Log("Discovery button pressed.");
|
||||
topologyBuilder.BuildTopologyFromJson();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("TopologyBuilder is not assigned!");
|
||||
}
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
Debug.Log("Cleaning up native resources");
|
||||
ControlLibrary.cleanup();
|
||||
}
|
||||
}
|
||||
11
Assets/Module/DiscoveryButton.cs.meta
Normal file
11
Assets/Module/DiscoveryButton.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af6bffac56bf545cbb57e4d649ef658d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Module/HubModule.cs
Normal file
9
Assets/Module/HubModule.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class HubModule : ModuleBase
|
||||
{
|
||||
public override void OnSelect() { }
|
||||
public override void DeSelect() { }
|
||||
}
|
||||
11
Assets/Module/HubModule.cs.meta
Normal file
11
Assets/Module/HubModule.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f2f97cf35ba04c2692842afd44fa995
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
0
Assets/Module/ModuleEnums.cs
Normal file
0
Assets/Module/ModuleEnums.cs
Normal file
11
Assets/Module/ModuleEnums.cs.meta
Normal file
11
Assets/Module/ModuleEnums.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39e68c3e09f364b97991203a662841ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
136
Assets/Module/ServoBendModuleFinal.prefab
Normal file
136
Assets/Module/ServoBendModuleFinal.prefab
Normal file
@@ -0,0 +1,136 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &630996614977717994
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 89583541483861791, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3109829847073703039, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: ServoBendModuleFinal
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3298615727327907093, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.012000001
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3298615727327907093, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3298615727327907093, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3298615727327907093, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3298615727327907093, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3298615727327907093, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 270
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3298615727327907093, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.0000024074689
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -0.000198856
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4339017592679235832, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4418717132062311738, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: servo_module_body_unity
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6143875053036137561, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 1.6824
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -0.64399993
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0.64
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7476108790034618784, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents:
|
||||
- {fileID: 6143875053036137561, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 4b60ff46518f54cdea157ba10a27703b, type: 3}
|
||||
7
Assets/Module/ServoBendModuleFinal.prefab.meta
Normal file
7
Assets/Module/ServoBendModuleFinal.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c6ff9c85cb0b4e54a56a4714e2245e7
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
445
Assets/Module/ServoStraightModule.prefab
Normal file
445
Assets/Module/ServoStraightModule.prefab
Normal file
@@ -0,0 +1,445 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1585740000427266238
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8192119221894231334}
|
||||
- component: {fileID: 5317732997072737755}
|
||||
- component: {fileID: 1094123167717167487}
|
||||
- component: {fileID: 5379513518535446921}
|
||||
m_Layer: 0
|
||||
m_Name: Body4
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8192119221894231334
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585740000427266238}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 10, z: 10}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3307183004308608585}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5317732997072737755
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585740000427266238}
|
||||
m_Mesh: {fileID: 8130605235924166793, guid: b250372aec9eb4e9ca58beb5ffff56f2, type: 3}
|
||||
--- !u!23 &1094123167717167487
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585740000427266238}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 7397659539795428015, guid: b250372aec9eb4e9ca58beb5ffff56f2, type: 3}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &5379513518535446921
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1585740000427266238}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.0037000026, y: 0.0028000008, z: 0.0056800027}
|
||||
m_Center: {x: -0.0018500006, y: 0.0012000005, z: 0.000060000446}
|
||||
--- !u!1 &1718181999778927011
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 221053328158825888}
|
||||
- component: {fileID: 8932377710995762919}
|
||||
- component: {fileID: 5092065077190790493}
|
||||
m_Layer: 0
|
||||
m_Name: Body7
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &221053328158825888
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1718181999778927011}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 10, z: 10}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2973263369850297978}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &8932377710995762919
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1718181999778927011}
|
||||
m_Mesh: {fileID: 9193857513607778490, guid: 80d7debcd48164452b7dc26bbb63dd91, type: 3}
|
||||
--- !u!23 &5092065077190790493
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1718181999778927011}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 7397659539795428015, guid: 80d7debcd48164452b7dc26bbb63dd91, type: 3}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!1 &2054521181450425562
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3307183004308608585}
|
||||
m_Layer: 0
|
||||
m_Name: servo_module_body_unity
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3307183004308608585
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2054521181450425562}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.7071068, y: -0, z: 0.7071068, w: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 8192119221894231334}
|
||||
- {fileID: 562035665133052636}
|
||||
m_Father: {fileID: 132986545947850755}
|
||||
m_LocalEulerAnglesHint: {x: 180, y: -90, z: 0}
|
||||
--- !u!1 &4137737942048637088
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4827752926272239954}
|
||||
m_Layer: 0
|
||||
m_Name: ArmSocket
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4827752926272239954
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4137737942048637088}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0.04, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6033256804543490672}
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!1 &4464132454168483798
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2973263369850297978}
|
||||
- component: {fileID: 328031671243845553}
|
||||
m_Layer: 0
|
||||
m_Name: servo_straight_module_arm_unity
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2973263369850297978
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4464132454168483798}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.5, y: -0.5, z: 0.5, w: -0.5}
|
||||
m_LocalPosition: {x: 0, y: -0.020100001, z: 0.054699995}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 221053328158825888}
|
||||
m_Father: {fileID: 6033256804543490672}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 270}
|
||||
--- !u!64 &328031671243845553
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4464132454168483798}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 5
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 0}
|
||||
--- !u!1 &6867075298355049526
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 132986545947850755}
|
||||
- component: {fileID: 3373752982435546590}
|
||||
- component: {fileID: 3409835012615339945}
|
||||
m_Layer: 0
|
||||
m_Name: ServoStraightModule
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &132986545947850755
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6867075298355049526}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 2.3963728, y: 0.19593057, z: 7.587204}
|
||||
m_LocalScale: {x: 20, y: 20, z: 20}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3307183004308608585}
|
||||
- {fileID: 6033256804543490672}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
--- !u!65 &3373752982435546590
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6867075298355049526}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.08327585, y: 0.031800803, z: 0.048330326}
|
||||
m_Center: {x: 0.007901405, y: -0.0111633865, z: -0.015733082}
|
||||
--- !u!114 &3409835012615339945
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6867075298355049526}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 95ceb19e8aaff4ec6af5e0b586ef8af1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
armPivot: {fileID: 6033256804543490672}
|
||||
highlightVisual: {fileID: 0}
|
||||
currentAngle: 0
|
||||
lastSentAngle: 0
|
||||
--- !u!1 &7437332450220906117
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 562035665133052636}
|
||||
m_Layer: 0
|
||||
m_Name: BodySocket
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &562035665133052636
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7437332450220906117}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.5, y: -0.5, z: 0.5, w: 0.5}
|
||||
m_LocalPosition: {x: -0.01846024, y: 0.011742475, z: -0.027799964}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 3307183004308608585}
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 90}
|
||||
--- !u!1 &8722536640042815046
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6033256804543490672}
|
||||
m_Layer: 0
|
||||
m_Name: ArmPivot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6033256804543490672
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8722536640042815046}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.0117, z: -0.0175}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2973263369850297978}
|
||||
- {fileID: 4827752926272239954}
|
||||
m_Father: {fileID: 132986545947850755}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
7
Assets/Module/ServoStraightModule.prefab.meta
Normal file
7
Assets/Module/ServoStraightModule.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3059d52069ecc4a25b965d348837f129
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
183
Assets/Module/TopologyBuilder.cs
Normal file
183
Assets/Module/TopologyBuilder.cs
Normal file
@@ -0,0 +1,183 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Frontend;
|
||||
|
||||
|
||||
|
||||
public class TopologyBuilder : MonoBehaviour
|
||||
{
|
||||
public ModuleSpawner spawner;
|
||||
|
||||
public static Dictionary<string, GameObject> idToInstance = new();
|
||||
|
||||
public void BuildTopologyFromJson()
|
||||
{
|
||||
|
||||
// todo: this is some really bad temporary code
|
||||
TopologyGraph graph = new TopologyGraph();
|
||||
RobotConfiguration config = ControlLibrary.getRobotConfiguration();
|
||||
|
||||
Dictionary<int, ModuleType> idToType = new();
|
||||
int moduleCount = config.ModulesLength;
|
||||
for (int i = 0; i < moduleCount; i++)
|
||||
{
|
||||
var n_module = config.Modules(i);
|
||||
if (n_module != null)
|
||||
{
|
||||
var module = n_module.Value;
|
||||
Debug.Log("Adding module " + module.Id);
|
||||
graph.Modules.Add(new ModuleData
|
||||
{
|
||||
Id = module.Id,
|
||||
Type = module.ModuleType.ToString(),
|
||||
Degree = module.ConfigurationAsMotorState().Angle
|
||||
});
|
||||
idToType.Add(module.Id, module.ModuleType);
|
||||
}
|
||||
}
|
||||
|
||||
int connectionCount = config.ConnectionsLength;
|
||||
for (int i = 0; i < connectionCount; i++)
|
||||
{
|
||||
var n_connection = config.Connections(i);
|
||||
if (n_connection != null)
|
||||
{
|
||||
var connection = n_connection.Value;
|
||||
Debug.Log("orientation: " + connection.Orientation);
|
||||
graph.Connections.Add(new Connection
|
||||
{
|
||||
FromModuleId = connection.FromModuleId,
|
||||
FromSocket = idToType[connection.FromModuleId] == ModuleType.SPLITTER ? "MaleSocket" + (connection.FromSocket == 0 ? "" : connection.FromSocket) : "MaleSocket",
|
||||
ToModuleId = connection.ToModuleId,
|
||||
ToSocket = "FemaleSocket",
|
||||
Orientation = connection.Orientation
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy previous topology root if it exists
|
||||
GameObject oldRoot = GameObject.Find("GeneratedTopology");
|
||||
if (oldRoot != null)
|
||||
{
|
||||
DestroyImmediate(oldRoot);
|
||||
}
|
||||
|
||||
// Create a new root GameObject to hold all modules
|
||||
GameObject topologyRoot = new GameObject("GeneratedTopology");
|
||||
topologyRoot.transform.localScale = new Vector3(20f, 20f, 20f);
|
||||
|
||||
|
||||
// Clean up old instances
|
||||
foreach (var oldModule in idToInstance.Values)
|
||||
{
|
||||
Destroy(oldModule);
|
||||
}
|
||||
idToInstance.Clear();
|
||||
|
||||
// First spawn all modules
|
||||
foreach (var module in graph.Modules)
|
||||
{
|
||||
// Debug.Log($"Before error: {module.Type}.");
|
||||
ModuleType type = Enum.Parse<ModuleType>(module.Type);
|
||||
GameObject prefab = spawner.GetPrefabForType(type);
|
||||
// GameObject prefab = spawner.GetPrefabForType(module.Type);
|
||||
if (prefab == null)
|
||||
{
|
||||
Debug.LogError($"No prefab found for type {module.Type}");
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObject instance = Instantiate(prefab, Vector3.zero, Quaternion.identity, topologyRoot.transform);
|
||||
instance.name = module.Id.ToString();
|
||||
|
||||
// instance.transform.localScale = new Vector3(20f, 20f, 20f);
|
||||
instance.transform.SetParent(topologyRoot.transform, false); // attach to root
|
||||
instance.transform.localScale = Vector3.one;
|
||||
idToInstance[module.Id.ToString()] = instance;
|
||||
|
||||
ModuleBase baseScript = instance.GetComponent<ModuleBase>();
|
||||
if (baseScript != null)
|
||||
{
|
||||
baseScript.moduleID = module.Id.ToString();
|
||||
if (module.Type.Contains("Servo") && module.Degree != null)
|
||||
{
|
||||
ServoMotorModule servo;
|
||||
if (module.Type == "Servo1")
|
||||
{
|
||||
servo = instance.GetComponent<ServoBendModule>();
|
||||
}
|
||||
else
|
||||
{
|
||||
servo = instance.GetComponent<ServoStraightModule>();
|
||||
}
|
||||
//ServoBendModule servo = instance.GetComponent<ServoBendModule>();
|
||||
// servo.SetInitialAngle(module.Degree);
|
||||
servo.InitialSetAngle(module.Degree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Then connect them
|
||||
foreach (var connection in graph.Connections)
|
||||
{
|
||||
if (!idToInstance.ContainsKey(connection.FromModuleId.ToString()) || !idToInstance.ContainsKey(connection.ToModuleId.ToString()))
|
||||
{
|
||||
Debug.LogWarning($"Missing instance for {connection.FromModuleId} or {connection.ToModuleId}");
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObject objFrom = idToInstance[connection.FromModuleId.ToString()];
|
||||
GameObject objTo = idToInstance[connection.ToModuleId.ToString()];
|
||||
|
||||
string socketA = connection.FromSocket;
|
||||
string socketB = connection.ToSocket;
|
||||
// Debug.LogError("FromModuleId: " + connection.FromModuleId + " ToModuleId: " + connection.ToModuleId + " FromSocket: " + socketA + " ToSocket: " + socketB);
|
||||
|
||||
ModuleData fromModule = graph.Modules.Find(m => m.Id == connection.FromModuleId);
|
||||
ModuleData toModule = graph.Modules.Find(m => m.Id == connection.ToModuleId);
|
||||
ModuleType fromType = Enum.Parse<ModuleType>(fromModule.Type);
|
||||
ModuleType toType = Enum.Parse<ModuleType>(toModule.Type);
|
||||
if ((fromType == ModuleType.SERVO_1 || fromType == ModuleType.SERVO_2) && socketA == "MaleSocket") {
|
||||
socketA = "ArmSocket";
|
||||
// Debug.LogError("here");
|
||||
}
|
||||
else if ((fromType == ModuleType.SERVO_1 || fromType == ModuleType.SERVO_2) && socketA == "FemaleSocket") {
|
||||
socketA = "BodySocket";
|
||||
// Debug.LogError("here1");
|
||||
}
|
||||
|
||||
if ((toType == ModuleType.SERVO_1 || toType == ModuleType.SERVO_2) && socketB == "MaleSocket") {
|
||||
socketB = "ArmSocket";
|
||||
// Debug.LogError("here2");
|
||||
}
|
||||
else if ((toType == ModuleType.SERVO_1 || toType == ModuleType.SERVO_2) && socketB == "FemaleSocket") {
|
||||
socketB = "BodySocket";
|
||||
// Debug.LogError("here3");
|
||||
}
|
||||
|
||||
float twistDegrees;
|
||||
switch (connection.Orientation)
|
||||
{
|
||||
case Orientation.Deg90:
|
||||
twistDegrees = 90f;
|
||||
break;
|
||||
case Orientation.Deg180:
|
||||
twistDegrees = 180f;
|
||||
break;
|
||||
case Orientation.Deg270:
|
||||
twistDegrees = 270f;
|
||||
break;
|
||||
default:
|
||||
twistDegrees = 0f;
|
||||
break;
|
||||
}
|
||||
|
||||
Debug.Log("twist deg " + twistDegrees);
|
||||
twistDegrees -= 90; // todo: we should not need to do this, there is a bug further down where the rotation is not correct
|
||||
|
||||
spawner.ConnectModules(objFrom, socketA, objTo, socketB, objFrom.transform.position, twistDegrees);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Module/TopologyBuilder.cs.meta
Normal file
11
Assets/Module/TopologyBuilder.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7380c6a0eef4047f3af73299bb501272
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Assets/Module/TopologyGraphModel.cs
Normal file
30
Assets/Module/TopologyGraphModel.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
// Root graph container
|
||||
[Serializable]
|
||||
public class TopologyGraph
|
||||
{
|
||||
public List<ModuleData> Modules = new List<ModuleData>();
|
||||
public List<Connection> Connections = new List<Connection>();
|
||||
}
|
||||
|
||||
// Individual module
|
||||
[Serializable]
|
||||
public class ModuleData
|
||||
{
|
||||
public int Id;
|
||||
public string Type;
|
||||
public float Degree;
|
||||
}
|
||||
|
||||
// Connection between modules
|
||||
[Serializable]
|
||||
public class Connection
|
||||
{
|
||||
public int FromModuleId;
|
||||
public string FromSocket;
|
||||
public int ToModuleId;
|
||||
public string ToSocket;
|
||||
public Orientation Orientation;
|
||||
}
|
||||
11
Assets/Module/TopologyGraphModel.cs.meta
Normal file
11
Assets/Module/TopologyGraphModel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 976fbcec007484578b0e2f1a4893aa72
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Module/battery_module_mf_unity.fbx
Normal file
BIN
Assets/Module/battery_module_mf_unity.fbx
Normal file
Binary file not shown.
109
Assets/Module/battery_module_mf_unity.fbx.meta
Normal file
109
Assets/Module/battery_module_mf_unity.fbx.meta
Normal file
@@ -0,0 +1,109 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9bb9c26ce95f4c38b0975e4796d7c84
|
||||
ModelImporter:
|
||||
serializedVersion: 22200
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
materials:
|
||||
materialImportMode: 2
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
removeConstantScaleCurves: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
importConstraints: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 0
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
useSRGBMaterialColor: 1
|
||||
sortHierarchyByName: 1
|
||||
importPhysicalCameras: 1
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
nodeNameCollisionStrategy: 1
|
||||
fileIdsGeneration: 2
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
bakeAxisConversion: 0
|
||||
preserveHierarchy: 0
|
||||
skinWeightsMode: 0
|
||||
maxBonesPerVertex: 4
|
||||
minBoneWeight: 0.001
|
||||
optimizeBones: 1
|
||||
meshOptimizationFlags: -1
|
||||
indexFormat: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVMarginMethod: 1
|
||||
secondaryUVMinLightmapResolution: 40
|
||||
secondaryUVMinObjectScale: 1
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
strictVertexDataChecks: 0
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||
blendShapeNormalImportMode: 1
|
||||
normalSmoothingSource: 0
|
||||
referencedClips: []
|
||||
importAnimation: 1
|
||||
humanDescription:
|
||||
serializedVersion: 3
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
globalScale: 1
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 0
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
autoGenerateAvatarMappingIfUnspecified: 1
|
||||
animationType: 2
|
||||
humanoidOversampling: 1
|
||||
avatarSetup: 0
|
||||
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
||||
importBlendShapeDeformPercent: 1
|
||||
remapMaterialsIfMaterialImportModeIsNone: 0
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
221
Assets/Module/battery_module_mf_unity.prefab
Normal file
221
Assets/Module/battery_module_mf_unity.prefab
Normal file
@@ -0,0 +1,221 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6759834348696850854
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8522446024276573590}
|
||||
m_Layer: 0
|
||||
m_Name: FemaleSocket
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8522446024276573590
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6759834348696850854}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0.7071068, z: -0.7071068, w: 0}
|
||||
m_LocalPosition: {x: 0, y: 0.02, z: 0.02}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4077927847297772526}
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 180, z: 0}
|
||||
--- !u!1 &8460340073298051408
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6174788492104592851}
|
||||
m_Layer: 0
|
||||
m_Name: MaleSocket
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6174788492104592851
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8460340073298051408}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 1, w: 0}
|
||||
m_LocalPosition: {x: -0.04000919, y: 0.02, z: 0.02}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4077927847297772526}
|
||||
m_LocalEulerAnglesHint: {x: -180, y: 180, z: 0}
|
||||
--- !u!1001 &4547805183318821893
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 1.8498
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -0.79997694
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -0.00024819374
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 180
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_ConstrainProportionsScale
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 919132149155446097, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: battery_module_mf_unity
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects:
|
||||
- targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 8522446024276573590}
|
||||
- targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 6174788492104592851}
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 8539805925341693153}
|
||||
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 1972764005790451530}
|
||||
- targetCorrespondingSourceObject: {fileID: -3372522033569347474, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 3574960819847320473}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
--- !u!1 &3736973296473420116 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
m_PrefabInstance: {fileID: 4547805183318821893}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &8539805925341693153
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3736973296473420116}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f0d44e50b94d44bf6b87f9db5a07981c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!65 &1972764005790451530
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3736973296473420116}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4077927847297772526 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
m_PrefabInstance: {fileID: 4547805183318821893}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &7939680856146035819 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: -3372522033569347474, guid: c9bb9c26ce95f4c38b0975e4796d7c84, type: 3}
|
||||
m_PrefabInstance: {fileID: 4547805183318821893}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!65 &3574960819847320473
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7939680856146035819}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.005000002, y: 0.004000002, z: 0.004000002}
|
||||
m_Center: {x: -0.002500001, y: 0.002000001, z: 0.002000001}
|
||||
7
Assets/Module/battery_module_mf_unity.prefab.meta
Normal file
7
Assets/Module/battery_module_mf_unity.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46058ab5ebab64d548b4008f54df1f6d
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user