From 72e6d4bdbbce00d299dc50c87fa514dd47b34a30 Mon Sep 17 00:00:00 2001 From: Claire Peta Date: Thu, 11 Apr 2019 18:00:57 +1000 Subject: [PATCH] Send/recieve moves from client and character move on server --- Assets/Prefabs/Character.prefab | 297 +----------------- Assets/Scenes/TuteLevelFive.unity | 152 ++++----- Assets/Scenes/TuteLevelFour.unity | 71 ++++- Assets/Scenes/TuteLevelOne.unity | 6 +- Assets/Scenes/TuteLevelThree.unity | 36 ++- Assets/Scenes/TuteLevelTwo.unity | 47 ++- Assets/Scripts/Character.cs | 4 +- Assets/Scripts/Logic/BlockReader.cs | 10 +- .../Networking/Server/NetworkedClient.cs | 7 +- 9 files changed, 222 insertions(+), 408 deletions(-) diff --git a/Assets/Prefabs/Character.prefab b/Assets/Prefabs/Character.prefab index 9d3334e..3881782 100644 --- a/Assets/Prefabs/Character.prefab +++ b/Assets/Prefabs/Character.prefab @@ -1,187 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &3160055282391962277 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 8001775178025394206} - - component: {fileID: 8013761145105902324} - - component: {fileID: 1116712125457233699} - - component: {fileID: 2961368372483826117} - m_Layer: 0 - m_Name: Sphere (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &8001775178025394206 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3160055282391962277} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0.1, y: 0.546, z: 0.484} - m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} - m_Children: [] - m_Father: {fileID: 3210769677811216532} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &8013761145105902324 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3160055282391962277} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &1116712125457233699 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3160055282391962277} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: ebc403a16f8803f4cb7b1fca470fa88d, 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_StitchLightmapSeams: 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!135 &2961368372483826117 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3160055282391962277} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!1 &5970776295824438666 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 6767072011031186058} - - component: {fileID: 5388231188832511744} - - component: {fileID: 5491211767220478932} - - component: {fileID: 5735388550244330859} - m_Layer: 0 - m_Name: Sphere - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &6767072011031186058 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5970776295824438666} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.1, y: 0.546, z: 0.4856666} - m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} - m_Children: [] - m_Father: {fileID: 3210769677811216532} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &5388231188832511744 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5970776295824438666} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &5491211767220478932 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5970776295824438666} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: ebc403a16f8803f4cb7b1fca470fa88d, 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_StitchLightmapSeams: 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!135 &5735388550244330859 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5970776295824438666} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} --- !u!1 &7426725930156175983 GameObject: m_ObjectHideFlags: 0 @@ -195,6 +13,7 @@ GameObject: - component: {fileID: 2631002120179805110} - component: {fileID: 315805078} - component: {fileID: 6815585465521158857} + - component: {fileID: 4912471391544438089} m_Layer: 0 m_Name: Character m_TagString: Untagged @@ -212,8 +31,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 3210769677811216532} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -229,14 +47,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 73c2eff8a9a01a44bb9b2c007539fc60, type: 3} m_Name: m_EditorClassIdentifier: - nextScene: TuteLevelThree - BlockMenu: {fileID: 0} - popUpText: {fileID: 0} + nextScene: MainMenu + startingInventory: {fileID: 11400000, guid: 57948efb1cd9603419511d2dd2eabc3d, type: 2} CurrentBlock: {fileID: 0} Ignore: serializedVersion: 2 m_Bits: 0 - PickUpTag: New Block + Inventory: {fileID: 11400000, guid: b6fa892e4c159bf46a2c4cda19627e97, type: 2} --- !u!114 &2631002120179805110 MonoBehaviour: m_ObjectHideFlags: 0 @@ -250,6 +67,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: character: {fileID: 2862111851184665482} + characterSpeed: 0.5 --- !u!54 &315805078 Rigidbody: m_ObjectHideFlags: 0 @@ -273,112 +91,25 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7426725930156175983} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: c0bbbf19cb68b2742bd80855243b64e3, type: 3} m_Name: m_EditorClassIdentifier: character: {fileID: 2862111851184665482} blockReader: - LogicChain: - - {fileID: 11400000, guid: 48f0ea7af28c10846b5b76ce70d06b60, type: 2} - - {fileID: 11400000, guid: 48f0ea7af28c10846b5b76ce70d06b60, type: 2} - - {fileID: 11400000, guid: aa238796cf1886244951ec8c2fed1855, type: 2} - - {fileID: 11400000, guid: 0b1bcd75cb7dade4fb598ee3412594c2, type: 2} - - {fileID: 11400000, guid: 41f4cb946475b2849a802a8297d81e25, type: 2} - - {fileID: 11400000, guid: 194f051bd7d3e7d4fb5b96a8e1d5b162, type: 2} + LogicChain: [] waitTime: 0.5 ---- !u!1 &8963196030949126965 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 3210769677811216532} - - component: {fileID: 6075528155835907407} - - component: {fileID: 6106388788957972115} - - component: {fileID: 8224122349518240122} - m_Layer: 0 - m_Name: Body - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &3210769677811216532 -Transform: +--- !u!65 &4912471391544438089 +BoxCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8963196030949126965} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0.5, z: 0} - m_LocalScale: {x: 0.6, y: 0.5, z: 0.6} - m_Children: - - {fileID: 6767072011031186058} - - {fileID: 8001775178025394206} - m_Father: {fileID: 7426725930156175971} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &6075528155835907407 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8963196030949126965} - m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &6106388788957972115 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8963196030949126965} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: fc8b102a2fe2ffa4ab2c352972a02f82, 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_StitchLightmapSeams: 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!136 &8224122349518240122 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8963196030949126965} + m_GameObject: {fileID: 7426725930156175983} m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 - m_Radius: 0.5 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0, y: 0, z: 0} + serializedVersion: 2 + m_Size: {x: 0.5, y: 0.5, z: 0.5} + m_Center: {x: 0, y: 0.35, z: 0} diff --git a/Assets/Scenes/TuteLevelFive.unity b/Assets/Scenes/TuteLevelFive.unity index fa77381..3f11609 100644 --- a/Assets/Scenes/TuteLevelFive.unity +++ b/Assets/Scenes/TuteLevelFive.unity @@ -237,7 +237,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 421711684} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} - m_Enabled: 0 + m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: c0bbbf19cb68b2742bd80855243b64e3, type: 3} m_Name: @@ -1946,11 +1946,6 @@ PrefabInstance: propertyPath: m_Name value: Character objectReference: {fileID: 0} - - target: {fileID: 7426725930156175983, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - target: {fileID: 7426725930156175971, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} propertyPath: m_LocalPosition.x @@ -2006,98 +2001,16 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: nextScene - value: MainMenu - objectReference: {fileID: 0} - - target: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: PickUpTag - value: New Block - objectReference: {fileID: 0} - - target: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: BlockMenu - value: - objectReference: {fileID: 1792455936} - - target: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: popUpText - value: - objectReference: {fileID: 1792455937} - - target: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: Inventory - value: - objectReference: {fileID: 11400000, guid: b6fa892e4c159bf46a2c4cda19627e97, - type: 2} - - target: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: startingInventory - value: - objectReference: {fileID: 11400000, guid: 57948efb1cd9603419511d2dd2eabc3d, - type: 2} - - target: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: characterAnimator - value: - objectReference: {fileID: 0} - - target: {fileID: 2631002120179805110, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_Enabled - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 2631002120179805110, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: characterSpeed - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 6815585465521158857, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: blockReader.LogicChain.Array.size - value: 0 - objectReference: {fileID: 0} - target: {fileID: 6815585465521158857, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} propertyPath: m_Enabled - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 6815585465521158857, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} propertyPath: waitTime value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 8963196030949126965, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5970776295824438666, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3160055282391962277, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6106388788957972115, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_Enabled - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1116712125457233699, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_Materials.Array.data[0] - value: - objectReference: {fileID: 2100000, guid: ebc403a16f8803f4cb7b1fca470fa88d, type: 2} - - target: {fileID: 5491211767220478932, guid: c176f4ae8f7b4074db99b27b2e015a2a, - type: 3} - propertyPath: m_Materials.Array.data[0] - value: - objectReference: {fileID: 2100000, guid: ebc403a16f8803f4cb7b1fca470fa88d, type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} --- !u!1 &425597736 stripped @@ -7267,6 +7180,67 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 1d9cc67243350f643b8c562ed0503c49, type: 3} +--- !u!1 &2061585765 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2061585768} + - component: {fileID: 2061585767} + - component: {fileID: 2061585766} + m_Layer: 0 + m_Name: Server + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2061585766 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2061585765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 77e0f9f175af31a4ba73a060da4829e5, type: 3} + m_Name: + m_EditorClassIdentifier: + server: {fileID: 11400000, guid: aba6c842adfc9904dba334cb48257361, type: 2} + input: {fileID: 20179508} +--- !u!114 &2061585767 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2061585765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 220b4889c8b3f7b4f84286ba8773e1b6, type: 3} + m_Name: + m_EditorClassIdentifier: + Port: 2222 + StartServerOnAwake: 1 + Server: {fileID: 11400000, guid: aba6c842adfc9904dba334cb48257361, type: 2} +--- !u!4 &2061585768 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2061585765} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.3310928, y: 0.862797, z: -0.61951685} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &2063277958 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/TuteLevelFour.unity b/Assets/Scenes/TuteLevelFour.unity index c59edfe..efb2930 100644 --- a/Assets/Scenes/TuteLevelFour.unity +++ b/Assets/Scenes/TuteLevelFour.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1} + m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641222, b: 0.57481694, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -322,6 +322,11 @@ PrefabInstance: propertyPath: m_Name value: Block Menu objectReference: {fileID: 0} + - target: {fileID: 6379596649083080720, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6379596649083080716, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} propertyPath: m_LocalPosition.x @@ -360,7 +365,7 @@ PrefabInstance: - target: {fileID: 6379596649083080716, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} propertyPath: m_RootOrder - value: 6 + value: 5 objectReference: {fileID: 0} - target: {fileID: 6379596649083080716, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} @@ -1459,11 +1464,31 @@ PrefabInstance: propertyPath: popUpText value: objectReference: {fileID: 1348313290} + - target: {fileID: 2631002120179805110, guid: c176f4ae8f7b4074db99b27b2e015a2a, + type: 3} + propertyPath: characterSpeed + value: 0.5 + objectReference: {fileID: 0} - target: {fileID: 6815585465521158857, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} propertyPath: m_Enabled value: 0 objectReference: {fileID: 0} + - target: {fileID: 5970776295824438666, guid: c176f4ae8f7b4074db99b27b2e015a2a, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3160055282391962277, guid: c176f4ae8f7b4074db99b27b2e015a2a, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6106388788957972115, guid: c176f4ae8f7b4074db99b27b2e015a2a, + type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} --- !u!1001 &629574877 @@ -2646,7 +2671,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1348022041 PrefabInstance: @@ -2921,6 +2946,7 @@ GameObject: - component: {fileID: 1571819310} - component: {fileID: 1571819309} - component: {fileID: 1571819308} + - component: {fileID: 1571819312} m_Layer: 0 m_Name: For-Loop m_TagString: New Block @@ -2939,7 +2965,7 @@ BoxCollider: m_IsTrigger: 1 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} + m_Size: {x: 1.5, y: 1.5, z: 1.5} m_Center: {x: 0, y: 0, z: 0} --- !u!23 &1571819309 MeshRenderer: @@ -2998,8 +3024,26 @@ Transform: m_LocalScale: {x: 0.3, y: 0.3, z: 0.3} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1571819312 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1571819307} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3de8ea85fe104ee46819ac1ff5e87159, type: 3} + m_Name: + m_EditorClassIdentifier: + Collectable: + element: {fileID: 11400000, guid: 02fe4498942f4dc4793eac71fb71f798, type: 2} + Count: 2 + isInfinit: 0 + BlockMenu: {fileID: 1724137008} + popUpText: {fileID: 1348313290} --- !u!1001 &1698327106 PrefabInstance: m_ObjectHideFlags: 0 @@ -3012,6 +3056,11 @@ PrefabInstance: propertyPath: m_Name value: Welcome Menu objectReference: {fileID: 0} + - target: {fileID: 7103365430685043221, guid: 80a26ed87f729434abe07a722ef15e7c, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7103365430685043225, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} propertyPath: m_LocalPosition.x @@ -3050,7 +3099,7 @@ PrefabInstance: - target: {fileID: 7103365430685043225, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} propertyPath: m_RootOrder - value: 7 + value: 6 objectReference: {fileID: 0} - target: {fileID: 7103365430685043225, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} @@ -3127,11 +3176,6 @@ PrefabInstance: propertyPath: m_RenderMode value: 1 objectReference: {fileID: 0} - - target: {fileID: 7103365430021195167, guid: 80a26ed87f729434abe07a722ef15e7c, - type: 3} - propertyPath: m_AnchoredPosition.y - value: -15 - objectReference: {fileID: 0} - target: {fileID: 7103365429638758419, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -3157,6 +3201,11 @@ PrefabInstance: cover greater distances drag and drop the move block to the tray then click play to watch the character move" objectReference: {fileID: 0} + - target: {fileID: 7103365430021195167, guid: 80a26ed87f729434abe07a722ef15e7c, + type: 3} + propertyPath: m_AnchoredPosition.y + value: -15 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} --- !u!1 &1724137008 stripped diff --git a/Assets/Scenes/TuteLevelOne.unity b/Assets/Scenes/TuteLevelOne.unity index d1dae68..d5614d1 100644 --- a/Assets/Scenes/TuteLevelOne.unity +++ b/Assets/Scenes/TuteLevelOne.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1} + m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641222, b: 0.57481694, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -953,12 +953,12 @@ PrefabInstance: - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_AnchoredPosition.x - value: 0.00014167631 + value: 0.00021078429 objectReference: {fileID: 0} - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} propertyPath: m_AnchoredPosition.y - value: -0.000000024434899 + value: 0.000011988396 objectReference: {fileID: 0} - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3} diff --git a/Assets/Scenes/TuteLevelThree.unity b/Assets/Scenes/TuteLevelThree.unity index 67215a4..d480d7c 100644 --- a/Assets/Scenes/TuteLevelThree.unity +++ b/Assets/Scenes/TuteLevelThree.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1} + m_IndirectSpecularColor: {r: 0.4465785, g: 0.49641222, b: 0.57481694, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -124,6 +124,11 @@ PrefabInstance: propertyPath: m_Name value: Welcome Menu objectReference: {fileID: 0} + - target: {fileID: 7103365430685043221, guid: 80a26ed87f729434abe07a722ef15e7c, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7103365430685043225, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} propertyPath: m_LocalPosition.x @@ -663,6 +668,11 @@ PrefabInstance: propertyPath: m_Enabled value: 0 objectReference: {fileID: 0} + - target: {fileID: 4912471391544438089, guid: c176f4ae8f7b4074db99b27b2e015a2a, + type: 3} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} --- !u!1001 &493092664 @@ -1238,6 +1248,7 @@ GameObject: - component: {fileID: 1606072383} - component: {fileID: 1606072382} - component: {fileID: 1606072381} + - component: {fileID: 1606072385} m_Layer: 0 m_Name: Rotate Right m_TagString: New Block @@ -1317,6 +1328,24 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1606072385 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1606072380} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3de8ea85fe104ee46819ac1ff5e87159, type: 3} + m_Name: + m_EditorClassIdentifier: + Collectable: + element: {fileID: 11400000, guid: 51fdbaf21c006cb4d8ff078522b03fec, type: 2} + Count: 0 + isInfinit: 0 + BlockMenu: {fileID: 2081762624} + popUpText: {fileID: 2081762625} --- !u!1001 &1714281965 PrefabInstance: m_ObjectHideFlags: 0 @@ -1656,6 +1685,11 @@ PrefabInstance: propertyPath: m_Name value: Block Menu objectReference: {fileID: 0} + - target: {fileID: 6379596649083080720, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6379596649083080716, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} propertyPath: m_LocalPosition.x diff --git a/Assets/Scenes/TuteLevelTwo.unity b/Assets/Scenes/TuteLevelTwo.unity index 0e7ac43..6f4e98f 100644 --- a/Assets/Scenes/TuteLevelTwo.unity +++ b/Assets/Scenes/TuteLevelTwo.unity @@ -442,6 +442,7 @@ GameObject: - component: {fileID: 237830962} - component: {fileID: 237830961} - component: {fileID: 237830960} + - component: {fileID: 237830964} m_Layer: 0 m_Name: Rotate Left m_TagString: New Block @@ -521,6 +522,24 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &237830964 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237830959} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3de8ea85fe104ee46819ac1ff5e87159, type: 3} + m_Name: + m_EditorClassIdentifier: + Collectable: + element: {fileID: 11400000, guid: 4f23e55aecdb22443a7451e7a72c879d, type: 2} + Count: 0 + isInfinit: 0 + BlockMenu: {fileID: 632167809} + popUpText: {fileID: 1838334843} --- !u!1001 &241938204 PrefabInstance: m_ObjectHideFlags: 0 @@ -784,7 +803,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4078466002560596, guid: 4c9f6adf60a275840b716082e3482212, type: 3} propertyPath: m_RootOrder - value: 9 + value: 8 objectReference: {fileID: 0} - target: {fileID: 4078466002560596, guid: 4c9f6adf60a275840b716082e3482212, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -1350,7 +1369,7 @@ PrefabInstance: - target: {fileID: 7103365430685043225, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} propertyPath: m_RootOrder - value: 10 + value: 9 objectReference: {fileID: 0} - target: {fileID: 7103365430685043225, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} @@ -1432,13 +1451,6 @@ PrefabInstance: propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: objectReference: {fileID: 1826484083} - - target: {fileID: 7103365430021195166, guid: 80a26ed87f729434abe07a722ef15e7c, - type: 3} - propertyPath: m_Text - value: "In this level you will learn how to use the \nrotate left block, a rotate - left block allows your character to rotate to the left 90 degrees\ndrag and - drop the move block to the tray then\nclick play to watch the character move" - objectReference: {fileID: 0} - target: {fileID: 7103365429884932622, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} propertyPath: m_Text @@ -1446,6 +1458,13 @@ PrefabInstance: Level Two' objectReference: {fileID: 0} + - target: {fileID: 7103365430021195166, guid: 80a26ed87f729434abe07a722ef15e7c, + type: 3} + propertyPath: m_Text + value: "In this level you will learn how to use the \nrotate left block, a rotate + left block allows your character to rotate to the left 90 degrees\ndrag and + drop the move block to the tray then\nclick play to watch the character move" + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 80a26ed87f729434abe07a722ef15e7c, type: 3} --- !u!1 &724768902 stripped @@ -2041,7 +2060,7 @@ Transform: - {fileID: 805091866} - {fileID: 364037167} m_Father: {fileID: 0} - m_RootOrder: 12 + m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1074244128 PrefabInstance: @@ -2315,7 +2334,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 14 + m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 17.706001, y: -34.179, z: 0} --- !u!1 &1448730309 stripped GameObject: @@ -2474,7 +2493,7 @@ PrefabInstance: - target: {fileID: 6379596649083080716, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} propertyPath: m_RootOrder - value: 11 + value: 10 objectReference: {fileID: 0} - target: {fileID: 6379596649083080716, guid: 12c252cb33f8c9d41be9fc3a9adb9bb9, type: 3} @@ -2690,7 +2709,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4367797782630074, guid: 8d102e899c856934a9f58af9c7508d59, type: 3} propertyPath: m_RootOrder - value: 13 + value: 12 objectReference: {fileID: 0} - target: {fileID: 4367797782630074, guid: 8d102e899c856934a9f58af9c7508d59, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -2996,7 +3015,7 @@ PrefabInstance: - target: {fileID: 7426725930156175971, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} propertyPath: m_RootOrder - value: 8 + value: 14 objectReference: {fileID: 0} - target: {fileID: 7426725930156175971, guid: c176f4ae8f7b4074db99b27b2e015a2a, type: 3} diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index 31337c7..4090cc6 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -82,10 +82,10 @@ public class Character : MonoBehaviour float elapsedTime = 0; Vector3 startPosition = Current.position; time *= 0.8f; - while (elapsedTime < 1.5f) + while (elapsedTime < time) { characterAnimator.Play("Walk"); - transform.position = Vector3.Lerp(startPosition, Target.VisualPosition, (elapsedTime / 1.5f)); + transform.position = Vector3.Lerp(startPosition, Target.VisualPosition, (elapsedTime / time)); yield return new WaitForEndOfFrame(); elapsedTime += Time.deltaTime; } diff --git a/Assets/Scripts/Logic/BlockReader.cs b/Assets/Scripts/Logic/BlockReader.cs index fcd0a0e..cf6f7fc 100644 --- a/Assets/Scripts/Logic/BlockReader.cs +++ b/Assets/Scripts/Logic/BlockReader.cs @@ -76,7 +76,8 @@ public class BlockReader public void Clear() { LogicChain.Clear(); - OnUpdate.Invoke(); + if (OnUpdate != null) + OnUpdate.Invoke(); } /// @@ -86,7 +87,8 @@ public class BlockReader public void Remove(LogicBlock item) { LogicChain.Remove(item); - OnUpdate.Invoke(); + if (OnUpdate != null) + OnUpdate.Invoke(); } /// @@ -96,7 +98,8 @@ public class BlockReader public void Add(LogicBlock item) { LogicChain.Add(item); - OnUpdate.Invoke(); + if (OnUpdate != null) + OnUpdate.Invoke(); } /// @@ -107,6 +110,7 @@ public class BlockReader public void Insert(int index, LogicBlock item) { LogicChain.Insert(index, item); + if (OnUpdate != null) OnUpdate.Invoke(); } diff --git a/Assets/Scripts/Networking/Server/NetworkedClient.cs b/Assets/Scripts/Networking/Server/NetworkedClient.cs index 5f6fe2c..f0ec9f2 100644 --- a/Assets/Scripts/Networking/Server/NetworkedClient.cs +++ b/Assets/Scripts/Networking/Server/NetworkedClient.cs @@ -9,7 +9,9 @@ public class NetworkedClient : MonoBehaviour { public ServerObject server; - public BlockReader reader; + + //public Character character; + public BlockInput input; // Start is called before the first frame update void Start() @@ -27,6 +29,7 @@ public class NetworkedClient : MonoBehaviour return; } - reader.LogicChain = new List(logicMsg.elements); + input.blockReader.LogicChain = new List(logicMsg.elements); + input.ReadAll(); } }