From b72f2d042c5625ccfe409f914fcc10a1d9bd15ab Mon Sep 17 00:00:00 2001 From: Claire Peta Date: Thu, 15 Aug 2019 14:37:00 +1000 Subject: [PATCH] Cannon, Water, Crystals and Conveyor all scripted and working with character animation Only tested in tutorial scene and hard coded the "Character" name, set up to get names or characters animals based on the connected clients list, but has yet to be tested --- .../Traps/Cannon_Shooting_Object.prefab | 4 +- Assets/Prefabs/Traps/Conveyor Belt.prefab | 3 + ...rystals.prefab => CubeWithCrystals.prefab} | 57 +- ...efab.meta => CubeWithCrystals.prefab.meta} | 0 Assets/Prefabs/Traps/FloatingOnWater.prefab | 680 +++++++++--------- Assets/Prefabs/Traps/ShootingCannon.prefab | 5 +- .../SinglePlayer Levels/TuteLevelOne.unity | 4 +- Assets/Scripts/Character.cs | 74 +- Assets/Scripts/Traps/CannonShot.cs | 51 +- Assets/Scripts/Traps/ConveyorBelt.cs | 33 +- Assets/Scripts/Traps/CubeWithCrystals.cs | 40 +- Assets/Scripts/Traps/FloatingOnWater.cs | 54 +- 12 files changed, 611 insertions(+), 394 deletions(-) rename Assets/Prefabs/Traps/{CudeWithCrystals.prefab => CubeWithCrystals.prefab} (90%) rename Assets/Prefabs/Traps/{CudeWithCrystals.prefab.meta => CubeWithCrystals.prefab.meta} (100%) diff --git a/Assets/Prefabs/Traps/Cannon_Shooting_Object.prefab b/Assets/Prefabs/Traps/Cannon_Shooting_Object.prefab index b041bb6..844c159 100644 --- a/Assets/Prefabs/Traps/Cannon_Shooting_Object.prefab +++ b/Assets/Prefabs/Traps/Cannon_Shooting_Object.prefab @@ -58,7 +58,7 @@ Rigidbody: m_GameObject: {fileID: 3506936643819969965} serializedVersion: 2 m_Mass: 1 - m_Drag: 1 + m_Drag: 0 m_AngularDrag: 0.05 m_UseGravity: 0 m_IsKinematic: 0 @@ -76,7 +76,7 @@ BoxCollider: m_IsTrigger: 1 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} + m_Size: {x: 0.5, y: 0.5, z: 0.5} m_Center: {x: 0, y: 0, z: 0} --- !u!1001 &4032901744580679509 PrefabInstance: diff --git a/Assets/Prefabs/Traps/Conveyor Belt.prefab b/Assets/Prefabs/Traps/Conveyor Belt.prefab index ffe59ec..3471f42 100644 --- a/Assets/Prefabs/Traps/Conveyor Belt.prefab +++ b/Assets/Prefabs/Traps/Conveyor Belt.prefab @@ -45,6 +45,9 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: clientData: {fileID: 11400000, guid: 78d89605739516c4f9c66fb270137102, type: 2} + left: 0 + forward: 0 + triggeranimate: 0 --- !u!1 &6298733943245737397 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Traps/CudeWithCrystals.prefab b/Assets/Prefabs/Traps/CubeWithCrystals.prefab similarity index 90% rename from Assets/Prefabs/Traps/CudeWithCrystals.prefab rename to Assets/Prefabs/Traps/CubeWithCrystals.prefab index 715b853..f09eddc 100644 --- a/Assets/Prefabs/Traps/CudeWithCrystals.prefab +++ b/Assets/Prefabs/Traps/CubeWithCrystals.prefab @@ -45,8 +45,10 @@ GameObject: m_Component: - component: {fileID: 9119206199061355250} - component: {fileID: 2280553813620852594} + - component: {fileID: 1952366153} + - component: {fileID: 1952366152} m_Layer: 0 - m_Name: CudeWithCrystals + m_Name: CubeWithCrystals m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -81,6 +83,39 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: crystals: {fileID: 7009033047396183185} + triggeranimate: 0 + triggeranimate1: 0 +--- !u!65 &1952366153 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9119206199061355249} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &1952366152 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9119206199061355249} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1a69d64be9f9e8543b4278d7f139f6f1, type: 3} + m_Name: + m_EditorClassIdentifier: + VisualOffset: {x: 0, y: 0, z: 0} + is_Walkable: 1 + isWater: 0 + isPit: 0 + isSpawnable: 0 + SpawnDirection: 2 --- !u!1001 &9119206197491717339 PrefabInstance: m_ObjectHideFlags: 0 @@ -136,6 +171,10 @@ PrefabInstance: propertyPath: m_Name value: Crystal2_Blue objectReference: {fileID: 0} + - target: {fileID: 1351645074694886, guid: 01b136a21d4d344429b829a7b1a12661, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 01b136a21d4d344429b829a7b1a12661, type: 3} --- !u!4 &9116306614291212775 stripped @@ -199,6 +238,10 @@ PrefabInstance: propertyPath: m_Name value: Crystal2 objectReference: {fileID: 0} + - target: {fileID: 1582377522939474, guid: acb4f5240f8cf0b4e911b555cd7d8b60, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: acb4f5240f8cf0b4e911b555cd7d8b60, type: 3} --- !u!4 &9115906075035381432 stripped @@ -218,6 +261,10 @@ PrefabInstance: propertyPath: m_Name value: Crystal2_Pink objectReference: {fileID: 0} + - target: {fileID: 1956409168649530, guid: 9c6910cdbb0ef93408a3da833d0feeb2, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4626633069526452, guid: 9c6910cdbb0ef93408a3da833d0feeb2, type: 3} propertyPath: m_LocalPosition.x value: 0.134 @@ -325,6 +372,10 @@ PrefabInstance: propertyPath: m_Name value: Crystal2_Orange objectReference: {fileID: 0} + - target: {fileID: 1834177709595652, guid: a9e26077c8fe35b40ab9e16a6e6d5294, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: a9e26077c8fe35b40ab9e16a6e6d5294, type: 3} --- !u!4 &9116052424124833850 stripped @@ -407,6 +458,10 @@ PrefabInstance: propertyPath: m_Name value: Crystal2_Green objectReference: {fileID: 0} + - target: {fileID: 1435387787644366, guid: 68b340d812c9ddc45a3c09a4613f4b07, type: 3} + propertyPath: m_StaticEditorFlags + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4799286435405670, guid: 68b340d812c9ddc45a3c09a4613f4b07, type: 3} propertyPath: m_LocalPosition.x value: 0.168 diff --git a/Assets/Prefabs/Traps/CudeWithCrystals.prefab.meta b/Assets/Prefabs/Traps/CubeWithCrystals.prefab.meta similarity index 100% rename from Assets/Prefabs/Traps/CudeWithCrystals.prefab.meta rename to Assets/Prefabs/Traps/CubeWithCrystals.prefab.meta diff --git a/Assets/Prefabs/Traps/FloatingOnWater.prefab b/Assets/Prefabs/Traps/FloatingOnWater.prefab index 0068f33..6193676 100644 --- a/Assets/Prefabs/Traps/FloatingOnWater.prefab +++ b/Assets/Prefabs/Traps/FloatingOnWater.prefab @@ -43,6 +43,8 @@ GameObject: m_Component: - component: {fileID: 7729055451593449897} - component: {fileID: 2253904448710596599} + - component: {fileID: 1960872160634340048} + - component: {fileID: 7078801716073993875} m_Layer: 0 m_Name: FloatingOnWater m_TagString: Untagged @@ -63,7 +65,6 @@ Transform: m_Children: - {fileID: 8460854531351183923} - {fileID: 7432853164086773831} - - {fileID: 8523851343712122817} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -81,369 +82,344 @@ MonoBehaviour: m_EditorClassIdentifier: clientData: {fileID: 11400000, guid: 78d89605739516c4f9c66fb270137102, type: 2} lilypad: {fileID: 3043143187275025574} ---- !u!1001 &7437530683803243968 -PrefabInstance: + triggeranimate: 0 + triggeranimate1: 0 +--- !u!65 &1960872160634340048 +BoxCollider: m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7114897324399640995} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 8460854531351183923} - m_Modifications: - - target: {fileID: 1689483960513604, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_Name - value: Flower4_2 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.y - value: 0.931 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.x - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.z - value: 2 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} ---- !u!4 &7432977658103809198 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, - type: 3} - m_PrefabInstance: {fileID: 7437530683803243968} + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &7078801716073993875 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} ---- !u!1001 &7437530683814418632 -PrefabInstance: + m_GameObject: {fileID: 7114897324399640995} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1a69d64be9f9e8543b4278d7f139f6f1, type: 3} + m_Name: + m_EditorClassIdentifier: + VisualOffset: {x: 0, y: 0, z: 0} + is_Walkable: 1 + isWater: 0 + isPit: 0 + isSpawnable: 0 + SpawnDirection: 2 +--- !u!1 &7435841367984412824 +GameObject: m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 8460854531351183923} - m_Modifications: - - target: {fileID: 1689483960513604, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_Name - value: Flower4_2 (1) - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.y - value: 0.93 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.x - value: 1.1 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.y - value: 1.1 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.z - value: 1.1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} ---- !u!4 &7432977658097158566 stripped + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7432977657908968882} + - component: {fileID: 7440673594798753004} + - component: {fileID: 7449868157388125232} + m_Layer: 0 + m_Name: Flower4_2 (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7432977657908968882 Transform: - m_CorrespondingSourceObject: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, - type: 3} - m_PrefabInstance: {fileID: 7437530683814418632} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} ---- !u!1001 &7437530683884543377 -PrefabInstance: + m_GameObject: {fileID: 7435841367984412824} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 1.005, z: 0} + m_LocalScale: {x: 0.6, y: 0.1, z: 0.6} + m_Children: [] + m_Father: {fileID: 8460854531351183923} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7440673594798753004 +MeshFilter: m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 7729055451593449897} - m_Modifications: - - target: {fileID: 1379645051613606, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_Name - value: Cube_Water - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 3074371251208262866, guid: 2cb12feb62290af4ab4634e7ac62b956, - type: 3} - propertyPath: m_Center.y - value: -1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 2cb12feb62290af4ab4634e7ac62b956, type: 3} ---- !u!4 &7432853164086773831 stripped + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7435841367984412824} + m_Mesh: {fileID: 4300000, guid: 4a45d11e88f706d4ebb66d42897779e0, type: 3} +--- !u!23 &7449868157388125232 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7435841367984412824} + 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: cc200860bee3eb94dad02af3bcf473b0, 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!1 &7435841368464351620 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7432977658103809198} + - component: {fileID: 7440673595514076656} + - component: {fileID: 7449868156525972780} + m_Layer: 0 + m_Name: Flower4_2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7432977658103809198 Transform: - m_CorrespondingSourceObject: {fileID: 4967946560886230, guid: 2cb12feb62290af4ab4634e7ac62b956, - type: 3} - m_PrefabInstance: {fileID: 7437530683884543377} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} ---- !u!1001 &7437530684430511324 -PrefabInstance: + m_GameObject: {fileID: 7435841368464351620} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.931, z: 0} + m_LocalScale: {x: 2, y: 1, z: 2} + m_Children: [] + m_Father: {fileID: 8460854531351183923} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7440673595514076656 +MeshFilter: m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 8460854531351183923} - m_Modifications: - - target: {fileID: 1689483960513604, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_Name - value: Flower4_2 (2) - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.y - value: 1.005 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.x - value: 0.6 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.y - value: 0.1 - objectReference: {fileID: 0} - - target: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} - propertyPath: m_LocalScale.z - value: 0.6 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 57ed0c24aae4edc4495ddde07d66cf23, type: 3} ---- !u!4 &7432977657908968882 stripped + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7435841368464351620} + m_Mesh: {fileID: 4300000, guid: 4a45d11e88f706d4ebb66d42897779e0, type: 3} +--- !u!23 &7449868156525972780 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7435841368464351620} + 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: cc200860bee3eb94dad02af3bcf473b0, 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!1 &7435841368464977036 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7432977658097158566} + - component: {fileID: 7440673595522822392} + - component: {fileID: 7449868156534980644} + m_Layer: 0 + m_Name: Flower4_2 (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7432977658097158566 Transform: - m_CorrespondingSourceObject: {fileID: 4599309359665518, guid: 57ed0c24aae4edc4495ddde07d66cf23, - type: 3} - m_PrefabInstance: {fileID: 7437530684430511324} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7435841368464977036} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.93, z: 0} + m_LocalScale: {x: 1.1, y: 1.1, z: 1.1} + m_Children: [] + m_Father: {fileID: 8460854531351183923} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7440673595522822392 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} ---- !u!1001 &8528138131228372493 -PrefabInstance: + m_GameObject: {fileID: 7435841368464977036} + m_Mesh: {fileID: 4300000, guid: 4a45d11e88f706d4ebb66d42897779e0, type: 3} +--- !u!23 &7449868156534980644 +MeshRenderer: m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 7729055451593449897} - m_Modifications: - - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_Name - value: Cube_Underwater - objectReference: {fileID: 0} - - target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalPosition.y - value: -1 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6060536008043278799, guid: e5fac62723232674aa487c9073f1ca07, - type: 3} - propertyPath: is_Walkable - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 6060536008043278799, guid: e5fac62723232674aa487c9073f1ca07, - type: 3} - propertyPath: isWater - value: 1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3} ---- !u!4 &8523851343712122817 stripped + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7435841368464977036} + 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: cc200860bee3eb94dad02af3bcf473b0, 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!1 &7436441375542225975 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7432853164086773831} + - component: {fileID: 7440135971177277077} + - component: {fileID: 7450390458478458945} + m_Layer: 0 + m_Name: Cube_Water + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 4294967295 + m_IsActive: 1 +--- !u!4 &7432853164086773831 Transform: - m_CorrespondingSourceObject: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, - type: 3} - m_PrefabInstance: {fileID: 8528138131228372493} + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7436441375542225975} + 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_Children: [] + m_Father: {fileID: 7729055451593449897} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7440135971177277077 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7436441375542225975} + m_Mesh: {fileID: 4300000, guid: d73f25ac0bcef5b469863e30ce33634b, type: 3} +--- !u!23 &7450390458478458945 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7436441375542225975} + 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: 5e101a1af208737469b8482764baf697, 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 diff --git a/Assets/Prefabs/Traps/ShootingCannon.prefab b/Assets/Prefabs/Traps/ShootingCannon.prefab index c8f4104..b3de7e9 100644 --- a/Assets/Prefabs/Traps/ShootingCannon.prefab +++ b/Assets/Prefabs/Traps/ShootingCannon.prefab @@ -253,10 +253,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 44366bd8a25270844bdd9a5db9f2b0e0, type: 3} m_Name: m_EditorClassIdentifier: - shootingRight: 0 + shootingRight: 1 + triggeranimate: 0 shootingObject: {fileID: 3506936643819969965, guid: e8cf547bc36bd094f860f652fbe08047, type: 3} - clientData: {fileID: 11400000, guid: 78d89605739516c4f9c66fb270137102, type: 2} + spawnLocation: {fileID: 4411312180479633393} --- !u!65 &7713460145294617833 BoxCollider: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity b/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity index b887074..43e9da9 100644 --- a/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity +++ b/Assets/Scenes/SinglePlayer Levels/TuteLevelOne.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57a10796a4b6ae47785d5aff82e05827e60c3c87a05107f924f289f3bd48265b -size 175456 +oid sha256:55c97cc550b62aea593f673fa33abf5f25e2cb288615a18a516d1ededae3b400 +size 188516 diff --git a/Assets/Scripts/Character.cs b/Assets/Scripts/Character.cs index df5ad74..d88998c 100644 --- a/Assets/Scripts/Character.cs +++ b/Assets/Scripts/Character.cs @@ -138,26 +138,72 @@ public class Character : MonoBehaviour transform.position = Target.VisualPosition; } - IEnumerator MoveConveyorCoroutine(Block Target, Transform Current, float time, float heightMax) + IEnumerator MoveConveyorForwardCoroutine(Block Target, Transform Current, float time, float heightMax) { float elapsedTime = 0; Vector3 startPosition = Current.position; + Vector3 charEndPosition = new Vector3(Current.position.x + 1.0f, Current.position.y, Current.position.z); time *= 0.8f; yield return new WaitForSeconds(0.05f); while (elapsedTime < time) { - transform.position = Vector3.Lerp(startPosition, Target.VisualPosition, (elapsedTime / time)); + transform.position = Vector3.Lerp(startPosition, charEndPosition, (elapsedTime / time)); yield return new WaitForEndOfFrame(); elapsedTime += Time.deltaTime; } - transform.position = Target.VisualPosition; + transform.position = charEndPosition; + } + IEnumerator MoveConveyorBackwardCoroutine(Block Target, Transform Current, float time, float heightMax) + { + float elapsedTime = 0; + Vector3 startPosition = Current.position; + Vector3 charEndPosition = new Vector3(Current.position.x - 1.0f, Current.position.y, Current.position.z); + time *= 0.8f; + yield return new WaitForSeconds(0.05f); + while (elapsedTime < time) + { + transform.position = Vector3.Lerp(startPosition, charEndPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + transform.position = charEndPosition; + } + IEnumerator MoveConveyorLeftCoroutine(Block Target, Transform Current, float time, float heightMax) + { + float elapsedTime = 0; + Vector3 startPosition = Current.position; + Vector3 charEndPosition = new Vector3(Current.position.x, Current.position.y, Current.position.z + 1.0f); + time *= 0.8f; + yield return new WaitForSeconds(0.05f); + while (elapsedTime < time) + { + transform.position = Vector3.Lerp(startPosition, charEndPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + transform.position = charEndPosition; + } + IEnumerator MoveConveyorRightCoroutine(Block Target, Transform Current, float time, float heightMax) + { + float elapsedTime = 0; + Vector3 startPosition = Current.position; + Vector3 charEndPosition = new Vector3(Current.position.x, Current.position.y, Current.position.z - 1.0f); + time *= 0.8f; + yield return new WaitForSeconds(0.05f); + while (elapsedTime < time) + { + transform.position = Vector3.Lerp(startPosition, charEndPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + transform.position = charEndPosition; } IEnumerator PushLeftCoroutine(Transform Current, float time) { float elapsedTime = 0; Vector3 startPosition = Current.transform.position; - Vector3 endPosition = new Vector3(Current.position.x, Current.position.y, Current.position.z - 10); + Vector3 endPosition = new Vector3(Current.position.x, Current.position.y, Current.position.z - 1.0f); time *= 0.8f; yield return new WaitForSeconds(0.05f); while (elapsedTime < time) @@ -173,7 +219,7 @@ public class Character : MonoBehaviour { float elapsedTime = 0; Vector3 startPosition = Current.transform.position; - Vector3 endPosition = new Vector3(Current.position.x, Current.position.y, Current.position.z + 10); + Vector3 endPosition = new Vector3(Current.position.x, Current.position.y, Current.position.z + 1.0f); time *= 0.8f; yield return new WaitForSeconds(0.05f); while (elapsedTime < time) @@ -256,11 +302,23 @@ public class Character : MonoBehaviour //transform.position = CurrentBlock.VisualPosition; } - public void conveyorMove(Direction direction, float speed) + public void conveyorMoveForward(Direction direction, float speed) { - Vector3 position = _currentBlock.position + direction.ToVector(transform); // position wanted - StartCoroutine(MoveConveyorCoroutine(_currentBlock, transform, speed, 0.3f)); + StartCoroutine(MoveConveyorForwardCoroutine(_currentBlock, transform, speed, 0.3f)); + } + public void conveyorMoveBackward(Direction direction, float speed) + { + StartCoroutine(MoveConveyorBackwardCoroutine(_currentBlock, transform, speed, 0.3f)); } + public void conveyorMoveLeft(Direction direction, float speed) + { + StartCoroutine(MoveConveyorLeftCoroutine(_currentBlock, transform, speed, 0.3f)); + } + public void conveyorMoveRight(Direction direction, float speed) + { + StartCoroutine(MoveConveyorRightCoroutine(_currentBlock, transform, speed, 0.3f)); + } + public void CannonRMove(float speed) { StartCoroutine(PushRightCoroutine(transform, speed)); diff --git a/Assets/Scripts/Traps/CannonShot.cs b/Assets/Scripts/Traps/CannonShot.cs index 9a4a3ff..0c1f70e 100644 --- a/Assets/Scripts/Traps/CannonShot.cs +++ b/Assets/Scripts/Traps/CannonShot.cs @@ -8,38 +8,75 @@ public class CannonShot : MonoBehaviour public bool shootingRight; public ConnectedClients clientData; GameObject player; - string charname; + string charname = "Character"; public List Names; + Rigidbody rb; private void Start() { Names.Add("Character"); + rb = this.gameObject.GetComponent(); /*for (int i = 0; i < clientData.AllClients.Count; i++) { Names.Add(clientData.AllClients[i].characterAnimal + "(Clone)"); }*/ } + IEnumerator PushLeftCoroutine(float time) + { + float elapsedTime = 0; + Vector3 startPosition = transform.position; + Vector3 endPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z - 1.0f); + time *= 0.8f; + yield return new WaitForSeconds(0.05f); + while (elapsedTime < time) + { + transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + transform.position = endPosition; + Destroy(gameObject); + } + + IEnumerator PushRightCoroutine(Transform Current, float time) + { + float elapsedTime = 0; + Vector3 startPosition = transform.position; + Vector3 endPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z + 1.0f); + time *= 0.8f; + yield return new WaitForSeconds(0.05f); + while (elapsedTime < time) + { + transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + transform.position = endPosition; + Destroy(gameObject); + } + + void OnTriggerEnter(Collider other) { foreach (string name in Names) { - Debug.Log(name); if (other.gameObject.name == name) { - charname = other.gameObject.name; - Debug.Log(charname); + rb.velocity = Vector3.zero; player = GameObject.Find(charname); + Rigidbody playerRB = player.GetComponent(); if (shootingRight == true) { - player.GetComponent().CannonLMove(1.0f); + StartCoroutine(PushLeftCoroutine(0.5f)); + player.GetComponent().CannonLMove(0.5f); } else { - player.GetComponent().CannonLMove(1.0f); + StartCoroutine(PushLeftCoroutine(0.5f)); + player.GetComponent().CannonLMove(0.5f); } } } } - } diff --git a/Assets/Scripts/Traps/ConveyorBelt.cs b/Assets/Scripts/Traps/ConveyorBelt.cs index 48769d2..a2fb628 100644 --- a/Assets/Scripts/Traps/ConveyorBelt.cs +++ b/Assets/Scripts/Traps/ConveyorBelt.cs @@ -8,8 +8,21 @@ public class ConveyorBelt : MonoBehaviour public ConnectedClients clientData; bool characterOnBelt = false; GameObject player; - string charname; + string charname = "Character"; private List Names; + public bool left; + public bool forward; + public bool triggeranimate; + + private void Update() + { + //for testing purposes + if (triggeranimate == true) + { + Animate(); + triggeranimate = false; + } + } private void Start() { @@ -33,6 +46,22 @@ public class ConveyorBelt : MonoBehaviour public void Animate() { player = GameObject.Find(charname); - player.GetComponent().conveyorMove(Direction.Forward, 1.0f); + + if(forward == true) + { + player.GetComponent().conveyorMoveForward(Direction.Forward, 1.0f); + } + else if (forward == false) + { + player.GetComponent().conveyorMoveBackward(Direction.Forward, 1.0f); + } + else if (left == true) + { + player.GetComponent().conveyorMoveLeft(Direction.Forward, 1.0f); + } + else if (left == false) + { + player.GetComponent().conveyorMoveRight(Direction.Forward, 1.0f); + } } } diff --git a/Assets/Scripts/Traps/CubeWithCrystals.cs b/Assets/Scripts/Traps/CubeWithCrystals.cs index 615e3bd..0d8d00c 100644 --- a/Assets/Scripts/Traps/CubeWithCrystals.cs +++ b/Assets/Scripts/Traps/CubeWithCrystals.cs @@ -6,11 +6,45 @@ public class CubeWithCrystals : MonoBehaviour { bool characterInWater = false; public GameObject crystals; + public bool triggeranimate; + public bool triggeranimate1; - IEnumerator GrowShrinkCoroutine(Vector3 endPosition) + private void Update() + { + //for testing purposes + if (triggeranimate == true) + { + Animate(); + triggeranimate = false; + } + //for testing purposes + if (triggeranimate1 == true) + { + returnToPosition(); + triggeranimate1 = false; + } + } + + IEnumerator GrowCoroutine() + { + float elapsedTime = 0; + Vector3 startPosition = crystals.transform.position; + Vector3 endPosition = new Vector3(crystals.transform.position.x, crystals.transform.position.y + 1.0f, crystals.transform.position.z); + float time = 0.8f; + while (elapsedTime < time) + { + transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + crystals.transform.position = endPosition; + } + + IEnumerator ShrinkCoroutine() { float elapsedTime = 0; Vector3 startPosition = crystals.transform.position; + Vector3 endPosition = new Vector3(crystals.transform.position.x, crystals.transform.position.y - 1.0f, crystals.transform.position.z); float time = 0.8f; while (elapsedTime < time) { @@ -23,10 +57,10 @@ public class CubeWithCrystals : MonoBehaviour public void Animate() { - StartCoroutine(GrowShrinkCoroutine(new Vector3(0, 1, 0))); + StartCoroutine(GrowCoroutine()); } public void returnToPosition() { - StartCoroutine(GrowShrinkCoroutine(new Vector3(0, 0, 0))); + StartCoroutine(ShrinkCoroutine()); } } diff --git a/Assets/Scripts/Traps/FloatingOnWater.cs b/Assets/Scripts/Traps/FloatingOnWater.cs index 019f28d..2dd3707 100644 --- a/Assets/Scripts/Traps/FloatingOnWater.cs +++ b/Assets/Scripts/Traps/FloatingOnWater.cs @@ -5,12 +5,30 @@ using Networking.Client; public class FloatingOnWater : MonoBehaviour { - bool characterInWater = false; + bool characterInWater = true; public ConnectedClients clientData; private List Names; public GameObject lilypad; GameObject player; - string charName; + string charName = "Character"; + public bool triggeranimate; + public bool triggeranimate1; + + private void Update() + { + //for testing purposes + if (triggeranimate == true) + { + Animate(); + triggeranimate = false; + } + //for testing purposes + if (triggeranimate1 == true) + { + returnToPosition(); + triggeranimate1 = false; + } + } private void Start() { @@ -21,30 +39,21 @@ public class FloatingOnWater : MonoBehaviour } void OnTriggerEnter(Collider other) { - Debug.Log("OnTriggerEnter for water tile at " - + this.transform.position.x + ", " - + this.transform.position.y + ", " - + this.transform.position.z + ", " - + "other.gameObject.name = " + other.gameObject.name); for(int i = 0; i < Names.Count; i++) { - Debug.Log("Checking name: " + Names[i]); - if (other.gameObject.name == Names[i]) { - Debug.Log(Names[i] + " is in the water!"); characterInWater = true; charName = other.gameObject.name; } - - Debug.Log("characterInWater = " + characterInWater); } } - IEnumerator FloatSinkCoroutine(Vector3 endPosition) + IEnumerator FloatCoroutine() { float elapsedTime = 0; Vector3 startPosition = lilypad.transform.position; + Vector3 endPosition = new Vector3(lilypad.transform.position.x, lilypad.transform.position.y + 1.0f, lilypad.transform.position.z); Vector3 charStartPosition = player.transform.position; Vector3 charEndPosition = new Vector3(player.transform.position.x, 1, player.transform.position.z); float time = 0.8f; @@ -59,16 +68,31 @@ public class FloatingOnWater : MonoBehaviour lilypad.transform.position = endPosition; } + IEnumerator SinkCoroutine() + { + float elapsedTime = 0; + Vector3 startPosition = lilypad.transform.position; + Vector3 endPosition = new Vector3(lilypad.transform.position.x, lilypad.transform.position.y - 1.0f, lilypad.transform.position.z); + float time = 0.8f; + while (elapsedTime < time) + { + lilypad.transform.position = Vector3.Lerp(startPosition, endPosition, (elapsedTime / time)); + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } + lilypad.transform.position = endPosition; + } + public void Animate() { if(characterInWater == true) { player = GameObject.Find(charName); - StartCoroutine(FloatSinkCoroutine(new Vector3(0, 1, 0))); + StartCoroutine(FloatCoroutine()); } } public void returnToPosition() { - StartCoroutine(FloatSinkCoroutine(new Vector3(0, 0, 0))); + StartCoroutine(SinkCoroutine()); } }