From 60a83fa5b3178932227b61cc3bc901770b34f585 Mon Sep 17 00:00:00 2001 From: excitedneon Date: Fri, 12 May 2017 01:23:59 +0300 Subject: [PATCH] Add a Hologram prefab and update buttons to support >1 targets --- Assets/Models/Hologram.blend | 4 +- Assets/Prefabs/Hologram.prefab | 169 +++++++++++ Assets/Prefabs/Hologram.prefab.meta | 9 + Assets/Scenes/TestMap.unity | 268 ++++++++++++------ Assets/Scripts/Entities/SyncBases/Button.cs | 10 +- Assets/Scripts/Entities/SyncBases/Computer.cs | 16 +- Assets/Scripts/Entities/SyncBases/Hologram.cs | 64 +++++ .../Entities/SyncBases/Hologram.cs.meta | 12 + 8 files changed, 446 insertions(+), 106 deletions(-) create mode 100644 Assets/Prefabs/Hologram.prefab create mode 100644 Assets/Prefabs/Hologram.prefab.meta create mode 100644 Assets/Scripts/Entities/SyncBases/Hologram.cs create mode 100644 Assets/Scripts/Entities/SyncBases/Hologram.cs.meta diff --git a/Assets/Models/Hologram.blend b/Assets/Models/Hologram.blend index 5c53d2b..cc7422e 100644 --- a/Assets/Models/Hologram.blend +++ b/Assets/Models/Hologram.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66f64f3c8b0551b36bad4a5a647851e3541c7e9b212d3fd3628a7a5829e8a391 -size 523148 +oid sha256:97601f98d3d5820e0fac3de23bc12bfe2497005fa0722d859f5d0891f85b7255 +size 527616 diff --git a/Assets/Prefabs/Hologram.prefab b/Assets/Prefabs/Hologram.prefab new file mode 100644 index 0000000..1e58710 --- /dev/null +++ b/Assets/Prefabs/Hologram.prefab @@ -0,0 +1,169 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1322065614505358} + m_IsPrefabParent: 1 +--- !u!1 &1149177136626514 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4184625238098062} + - component: {fileID: 33323156521261314} + - component: {fileID: 23583528089297200} + - component: {fileID: 95356416840459302} + m_Layer: 0 + m_Name: Hologram Mesh + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1 &1322065614505358 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4689370038551000} + - component: {fileID: 114295198600795518} + - component: {fileID: 114171175549544602} + m_Layer: 0 + m_Name: Hologram + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4184625238098062 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1149177136626514} + m_LocalRotation: {x: -0.5000007, y: -0.49999928, z: -0.49999928, w: 0.5000007} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4689370038551000} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -90.00001, y: 0, z: -90.00001} +--- !u!4 &4689370038551000 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1322065614505358} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.39999998, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4184625238098062} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23583528089297200 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1149177136626514} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: 0512e7921046d4372ac4b499027cfca4, type: 2} + - {fileID: 2100000, guid: cc4c08d204a79447484ac0feba2a009b, type: 2} + - {fileID: 2100000, guid: d0e06f49f789848479496513ddc9d4a6, type: 2} + - {fileID: 2100000, guid: bc07ff2ef266a4661adc506da3430c31, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + 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 +--- !u!33 &33323156521261314 +MeshFilter: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1149177136626514} + m_Mesh: {fileID: 4300000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} +--- !u!95 &95356416840459302 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1149177136626514} + m_Enabled: 1 + m_Avatar: {fileID: 9000000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 +--- !u!114 &114171175549544602 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1322065614505358} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0e0b8f69a817648969bf8ecd70b13d4d, type: 3} + m_Name: + m_EditorClassIdentifier: + TextProperties: + Text: + Background: {r: 0, g: 0, b: 0, a: 0} + FontSize: 32 + Width: 256 + Height: 256 + Mesh: {fileID: 23583528089297200} + MaterialIndex: 3 + Emissive: 0 + Brightness: 1 +--- !u!114 &114295198600795518 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1322065614505358} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b128d3bedf18c46f6b23cf529a954f59, type: 3} + m_Name: + m_EditorClassIdentifier: + ID: 0 + Visible: 1 + Text: {fileID: 0} diff --git a/Assets/Prefabs/Hologram.prefab.meta b/Assets/Prefabs/Hologram.prefab.meta new file mode 100644 index 0000000..23cc53d --- /dev/null +++ b/Assets/Prefabs/Hologram.prefab.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3da42b42c71f841c2a977cfb5255b00f +timeCreated: 1494540155 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/TestMap.unity b/Assets/Scenes/TestMap.unity index 904abd7..23d9c40 100644 --- a/Assets/Scenes/TestMap.unity +++ b/Assets/Scenes/TestMap.unity @@ -1118,7 +1118,6 @@ GameObject: m_Component: - component: {fileID: 784099997} - component: {fileID: 784099995} - - component: {fileID: 784099993} - component: {fileID: 784099998} m_Layer: 0 m_Name: Screen @@ -1127,27 +1126,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &784099993 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 784099992} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0e0b8f69a817648969bf8ecd70b13d4d, type: 3} - m_Name: - m_EditorClassIdentifier: - TextProperties: - Text: Hello, world!\nBoo! - Background: {r: 0, g: 0, b: 0, a: 0} - FontSize: 32 - Width: 256 - Height: 256 - Mesh: {fileID: 1539986579} - MaterialIndex: 3 - Emissive: 0 - Brightness: 1 --- !u!65 &784099995 BoxCollider: m_ObjectHideFlags: 0 @@ -1170,7 +1148,7 @@ Transform: m_LocalPosition: {x: 3, y: 1.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 1539986578} + - {fileID: 1693409232} - {fileID: 746314095} m_Father: {fileID: 949094013} m_RootOrder: 8 @@ -1187,8 +1165,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ID: 0 - Screen: {fileID: 784099993} - Hologram: {fileID: 1539986578} + Screen: {fileID: 1931202596} + Hologram: {fileID: 1693409233} KeyLeft: {fileID: 1848764882} KeyRight: {fileID: 1999224091} --- !u!1 &792995699 @@ -1441,6 +1419,12 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 829930057} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!114 &865482261 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 114295198600795518, guid: 3da42b42c71f841c2a977cfb5255b00f, + type: 2} + m_PrefabInternal: {fileID: 1203899440} + m_Script: {fileID: 11500000, guid: b128d3bedf18c46f6b23cf529a954f59, type: 3} --- !u!1 &949094012 GameObject: m_ObjectHideFlags: 0 @@ -1704,6 +1688,65 @@ Transform: m_Father: {fileID: 949094013} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1203899440 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1988211392} + m_Modifications: + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalPosition.x + value: -0.199 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalPosition.y + value: 0.337 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114295198600795518, guid: 3da42b42c71f841c2a977cfb5255b00f, + type: 2} + propertyPath: Visible + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4184625238098062, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalScale.x + value: 0.75 + objectReference: {fileID: 0} + - target: {fileID: 4184625238098062, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalScale.y + value: 0.75 + objectReference: {fileID: 0} + - target: {fileID: 4184625238098062, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalScale.z + value: 0.75 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + m_IsPrefabParent: 0 --- !u!1 &1304969965 GameObject: m_ObjectHideFlags: 0 @@ -1959,6 +2002,11 @@ Prefab: m_Modification: m_TransformParent: {fileID: 949094013} m_Modifications: + - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, + type: 2} + propertyPath: WillTrigger.Array.size + value: 2 + objectReference: {fileID: 0} - target: {fileID: 4974430339442808, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} propertyPath: m_LocalPosition.x value: -3 @@ -1995,12 +2043,38 @@ Prefab: type: 2} propertyPath: WillTrigger value: - objectReference: {fileID: 310461193} + objectReference: {fileID: 0} - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} propertyPath: BlinkBrightness value: 1.4 objectReference: {fileID: 0} + - target: {fileID: 4566397176341920, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} + propertyPath: m_LocalPosition.y + value: 0.2 + objectReference: {fileID: 0} + - target: {fileID: 4566397176341920, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} + propertyPath: m_LocalScale.x + value: 0.4 + objectReference: {fileID: 0} + - target: {fileID: 4566397176341920, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} + propertyPath: m_LocalScale.y + value: 0.4 + objectReference: {fileID: 0} + - target: {fileID: 4566397176341920, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} + propertyPath: m_LocalScale.z + value: 0.4 + objectReference: {fileID: 0} + - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, + type: 2} + propertyPath: WillTrigger.Array.data[0] + value: + objectReference: {fileID: 865482261} + - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, + type: 2} + propertyPath: WillTrigger.Array.data[1] + value: + objectReference: {fileID: 310461193} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} m_IsPrefabParent: 0 @@ -2080,65 +2154,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &1539986577 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 784099997} - m_Modifications: - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalPosition.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalPosition.y - value: -0.4 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalRotation.x - value: -0.5000007 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalRotation.y - value: -0.49999928 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalRotation.z - value: -0.49999928 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalRotation.w - value: 0.5000007 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -90.00001 - objectReference: {fileID: 0} - - target: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: -90.00001 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - m_IsPrefabParent: 0 ---- !u!4 &1539986578 stripped -Transform: - m_PrefabParentObject: {fileID: 400000, guid: fc26c95dfc47945d5b323d895acc1d06, type: 3} - m_PrefabInternal: {fileID: 1539986577} ---- !u!23 &1539986579 stripped -MeshRenderer: - m_PrefabParentObject: {fileID: 2300000, guid: fc26c95dfc47945d5b323d895acc1d06, - type: 3} - m_PrefabInternal: {fileID: 1539986577} --- !u!1 &1610252928 GameObject: m_ObjectHideFlags: 0 @@ -2183,6 +2198,17 @@ Transform: m_Father: {fileID: 344272455} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &1693409232 stripped +Transform: + m_PrefabParentObject: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, + type: 2} + m_PrefabInternal: {fileID: 1931202595} +--- !u!114 &1693409233 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 114295198600795518, guid: 3da42b42c71f841c2a977cfb5255b00f, + type: 2} + m_PrefabInternal: {fileID: 1931202595} + m_Script: {fileID: 11500000, guid: b128d3bedf18c46f6b23cf529a954f59, type: 3} --- !u!1 &1706692498 GameObject: m_ObjectHideFlags: 0 @@ -2441,6 +2467,11 @@ Prefab: m_Modification: m_TransformParent: {fileID: 949094013} m_Modifications: + - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, + type: 2} + propertyPath: WillTrigger.Array.size + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4974430339442808, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} propertyPath: m_LocalPosition.x value: 3 @@ -2477,7 +2508,7 @@ Prefab: type: 2} propertyPath: WillTrigger value: - objectReference: {fileID: 784099998} + objectReference: {fileID: 0} - target: {fileID: 1801497498412898, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} propertyPath: m_Name value: Button Left @@ -2487,6 +2518,11 @@ Prefab: propertyPath: BlinkBrightness value: 1.4 objectReference: {fileID: 0} + - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, + type: 2} + propertyPath: WillTrigger.Array.data[0] + value: + objectReference: {fileID: 784099998} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} m_IsPrefabParent: 0 @@ -2501,6 +2537,54 @@ MonoBehaviour: type: 2} m_PrefabInternal: {fileID: 1848764880} m_Script: {fileID: 11500000, guid: 962f4855dcb8f4584839a7448e385201, type: 3} +--- !u!1001 &1931202595 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 784099997} + m_Modifications: + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalPosition.y + value: -0.39999998 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 3da42b42c71f841c2a977cfb5255b00f, type: 2} + m_IsPrefabParent: 0 +--- !u!114 &1931202596 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 114171175549544602, guid: 3da42b42c71f841c2a977cfb5255b00f, + type: 2} + m_PrefabInternal: {fileID: 1931202595} + m_Script: {fileID: 11500000, guid: 0e0b8f69a817648969bf8ecd70b13d4d, type: 3} --- !u!1 &1939832656 GameObject: m_ObjectHideFlags: 0 @@ -2557,6 +2641,11 @@ Prefab: m_Modification: m_TransformParent: {fileID: 949094013} m_Modifications: + - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, + type: 2} + propertyPath: WillTrigger.Array.size + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4974430339442808, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} propertyPath: m_LocalPosition.x value: 3 @@ -2593,7 +2682,7 @@ Prefab: type: 2} propertyPath: WillTrigger value: - objectReference: {fileID: 784099998} + objectReference: {fileID: 0} - target: {fileID: 1801497498412898, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} propertyPath: m_Name value: Button Right @@ -2603,6 +2692,11 @@ Prefab: propertyPath: BlinkBrightness value: 1.4 objectReference: {fileID: 0} + - target: {fileID: 114327153796435004, guid: 660bef6a67fed4941b963e96ff20a5e0, + type: 2} + propertyPath: WillTrigger.Array.data[0] + value: + objectReference: {fileID: 784099998} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 660bef6a67fed4941b963e96ff20a5e0, type: 2} m_IsPrefabParent: 0 diff --git a/Assets/Scripts/Entities/SyncBases/Button.cs b/Assets/Scripts/Entities/SyncBases/Button.cs index 7855d90..a6f2991 100644 --- a/Assets/Scripts/Entities/SyncBases/Button.cs +++ b/Assets/Scripts/Entities/SyncBases/Button.cs @@ -16,7 +16,7 @@ namespace Cyber.Entities.SyncBases { /// /// The interactable which this button will trigger. /// - public Interactable WillTrigger; + public Interactable[] WillTrigger; /// /// The button mesh that will blink. @@ -48,10 +48,12 @@ namespace Cyber.Entities.SyncBases { /// public override void Interact(SyncBase Trigger) { BlinkTime = Time.time; - if (WillTrigger != null) { - WillTrigger.Interact(this); + if (WillTrigger.Length > 0) { + foreach (Interactable Triggerable in WillTrigger) { + Triggerable.Interact(this); + } } else { - Term.Println("FIXME: The button '" + gameObject.name + "' was pressed, but it doesn't have a WillTrigger."); + Term.Println("FIXME: The button '" + gameObject.name + "' was pressed, but it doesn't have anything to trigger."); } } diff --git a/Assets/Scripts/Entities/SyncBases/Computer.cs b/Assets/Scripts/Entities/SyncBases/Computer.cs index 55b632b..e02a7cd 100644 --- a/Assets/Scripts/Entities/SyncBases/Computer.cs +++ b/Assets/Scripts/Entities/SyncBases/Computer.cs @@ -30,7 +30,7 @@ namespace Cyber.Entities.SyncBases { /// If the computer has a hologram as a screen, and is set here, the /// hologram will be animated properly when the computer is shut down. /// - public Transform Hologram; + public Hologram Hologram; /// /// The "left" key for this computer. Might cause actions depending @@ -50,8 +50,6 @@ namespace Cyber.Entities.SyncBases { /// public RunProgram Program; - private bool ComputerOn = true; - /// /// Runs the with some input, determined by the /// Trigger. @@ -59,14 +57,14 @@ namespace Cyber.Entities.SyncBases { /// Determines the keycode given to the /// . public override void Interact(SyncBase Trigger) { - ComputerOn = true; + Hologram.Visible = true; if (Trigger == KeyLeft) { Screen.SetTextProperties(new TextTextureProperties("\n Pressed left!")); } else if (Trigger == KeyRight) { Screen.SetTextProperties(new TextTextureProperties("\n Pressed right!")); } else { Screen.SetTextProperties(new TextTextureProperties("")); - ComputerOn = false; + Hologram.Visible = false; } } @@ -103,13 +101,5 @@ namespace Cyber.Entities.SyncBases { public override InteractableSyncdata GetInteractableSyncdata() { return new InteractableSyncdata(true, true); } - - private void Update() { - if (Hologram != null) { - float Scale = ComputerOn ? 1 : 0; - Hologram.localScale = Vector3.Lerp(Hologram.localScale, - new Vector3(Scale, Scale, Scale), 8f * Time.deltaTime); - } - } } } \ No newline at end of file diff --git a/Assets/Scripts/Entities/SyncBases/Hologram.cs b/Assets/Scripts/Entities/SyncBases/Hologram.cs new file mode 100644 index 0000000..93e10e8 --- /dev/null +++ b/Assets/Scripts/Entities/SyncBases/Hologram.cs @@ -0,0 +1,64 @@ +using UnityEngine; +using Cyber.Util; + +namespace Cyber.Entities.SyncBases { + + /// + /// Helper component for hologram meshes. + /// + public class Hologram : Interactable { + + /// + /// Whether the hologram is visible or not. + /// + public bool Visible = true; + + /// + /// The texture that will handle the text which is displayed on this + /// hologram. + /// + public TextTextureApplier Text; + + private float CurrentScale; + + public override void Interact(SyncBase Trigger) { + Visible = !Visible; + } + + public override void Deserialize(UnityEngine.Networking.NetworkReader reader) { + } + + public override void Serialize(UnityEngine.Networking.NetworkWriter writer) { + } + + public override SyncHandletype GetSyncHandletype() { + return new SyncHandletype(false, 10); + } + + public override InteractableSyncdata GetInteractableSyncdata() { + return new InteractableSyncdata(false, false); + } + + private void Start() { + CurrentScale = Visible ? 1 : 0; + UpdateScale(); + } + + private void Update() { + float Scale = Visible ? 1 : 0; + if (Scale != CurrentScale) { + UpdateScale(); + } + } + + private void UpdateScale() { + float Scale = Visible ? 1 : 0; + CurrentScale = Mathf.Lerp(CurrentScale, Scale, 8f * Time.deltaTime); + if (Mathf.Abs(Scale - CurrentScale) < 0.05) { + CurrentScale = Scale; + } + transform.localScale = + new Vector3(CurrentScale, CurrentScale, CurrentScale); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Entities/SyncBases/Hologram.cs.meta b/Assets/Scripts/Entities/SyncBases/Hologram.cs.meta new file mode 100644 index 0000000..afe48bc --- /dev/null +++ b/Assets/Scripts/Entities/SyncBases/Hologram.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b128d3bedf18c46f6b23cf529a954f59 +timeCreated: 1494539732 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: