From 85fe992fa1cc8b7f7c847048731f73ded6bd0f13 Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Thu, 15 Apr 2021 15:10:58 +0100 Subject: [PATCH] use events to link plate and door also removed unnecessary prefabs and moved animations to animation folder --- .../Pressure Plate Door.meta} | 2 +- .../Pressure Plate Door}/Door.meta | 0 .../Pressure Plate Door}/Door/Door.controller | 0 .../Door/Door.controller.meta | 0 .../Pressure Plate Door}/Door/DoorUp.anim | 0 .../Door/DoorUp.anim.meta | 0 .../Pressure Plate Door/Pressure Plate.meta} | 0 .../Pressure Plate}/PPdown.anim | 0 .../Pressure Plate}/PPdown.anim.meta | 0 .../Pressure Plate}/PPup.anim | 0 .../Pressure Plate}/PPup.anim.meta | 0 .../Pressure Plate}/Plate.controller | 0 .../Pressure Plate}/Plate.controller.meta | 0 .../{Animations.meta => Screen.meta} | 0 .../{Animations => Screen}/BlackScreen.anim | 0 .../BlackScreen.anim.meta | 0 .../Death(prototype).anim | 0 .../Death(prototype).anim.meta | 0 .../{Animations => Screen}/fadeToBlack.anim | 0 .../fadeToBlack.anim.meta | 0 .../{Animations => Screen}/fadeToClear.anim | 0 .../fadeToClear.anim.meta | 0 .../PressurePlateDoor/DoorParent.prefab | 14 ++ .../PressurePlateDoor/PlateParent.prefab | 8 +- game/Assets/Scenes/PressurePlate.unity | 82 +++++++--- game/Assets/Scripts/PressurePlate/Door.cs | 20 +++ .../Assets/Scripts/PressurePlate/Door.cs.meta | 11 ++ .../PressurePlate/Door/trash/Plate.prefab | 147 ------------------ .../Door/trash/Plate.prefab.meta | 7 - .../Door/trash/PressurePlate 1.prefab | 99 ------------ .../Door/trash/PressurePlate 1.prefab.meta | 7 - ...ressurePlateScript.cs => PressurePlate.cs} | 20 ++- ...teScript.cs.meta => PressurePlate.cs.meta} | 0 33 files changed, 122 insertions(+), 295 deletions(-) rename game/Assets/{Scripts/PressurePlate/Door/trash.meta => Animation/Pressure Plate Door.meta} (77%) rename game/Assets/{Scripts/PressurePlate => Animation/Pressure Plate Door}/Door.meta (100%) rename game/Assets/{Scripts/PressurePlate => Animation/Pressure Plate Door}/Door/Door.controller (100%) rename game/Assets/{Scripts/PressurePlate => Animation/Pressure Plate Door}/Door/Door.controller.meta (100%) rename game/Assets/{Scripts/PressurePlate => Animation/Pressure Plate Door}/Door/DoorUp.anim (100%) rename game/Assets/{Scripts/PressurePlate => Animation/Pressure Plate Door}/Door/DoorUp.anim.meta (100%) rename game/Assets/{Scripts/PressurePlate/PP.meta => Animation/Pressure Plate Door/Pressure Plate.meta} (100%) rename game/Assets/{Scripts/PressurePlate/PP => Animation/Pressure Plate Door/Pressure Plate}/PPdown.anim (100%) rename game/Assets/{Scripts/PressurePlate/PP => Animation/Pressure Plate Door/Pressure Plate}/PPdown.anim.meta (100%) rename game/Assets/{Scripts/PressurePlate/PP => Animation/Pressure Plate Door/Pressure Plate}/PPup.anim (100%) rename game/Assets/{Scripts/PressurePlate/PP => Animation/Pressure Plate Door/Pressure Plate}/PPup.anim.meta (100%) rename game/Assets/{Scripts/PressurePlate/PP => Animation/Pressure Plate Door/Pressure Plate}/Plate.controller (100%) rename game/Assets/{Scripts/PressurePlate/PP => Animation/Pressure Plate Door/Pressure Plate}/Plate.controller.meta (100%) rename game/Assets/Animation/{Animations.meta => Screen.meta} (100%) rename game/Assets/Animation/{Animations => Screen}/BlackScreen.anim (100%) rename game/Assets/Animation/{Animations => Screen}/BlackScreen.anim.meta (100%) rename game/Assets/Animation/{Animations => Screen}/Death(prototype).anim (100%) rename game/Assets/Animation/{Animations => Screen}/Death(prototype).anim.meta (100%) rename game/Assets/Animation/{Animations => Screen}/fadeToBlack.anim (100%) rename game/Assets/Animation/{Animations => Screen}/fadeToBlack.anim.meta (100%) rename game/Assets/Animation/{Animations => Screen}/fadeToClear.anim (100%) rename game/Assets/Animation/{Animations => Screen}/fadeToClear.anim.meta (100%) create mode 100644 game/Assets/Scripts/PressurePlate/Door.cs create mode 100644 game/Assets/Scripts/PressurePlate/Door.cs.meta delete mode 100644 game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab delete mode 100644 game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab.meta delete mode 100644 game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab delete mode 100644 game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab.meta rename game/Assets/Scripts/PressurePlate/{PressurePlateScript.cs => PressurePlate.cs} (74%) rename game/Assets/Scripts/PressurePlate/{PressurePlateScript.cs.meta => PressurePlate.cs.meta} (100%) diff --git a/game/Assets/Scripts/PressurePlate/Door/trash.meta b/game/Assets/Animation/Pressure Plate Door.meta similarity index 77% rename from game/Assets/Scripts/PressurePlate/Door/trash.meta rename to game/Assets/Animation/Pressure Plate Door.meta index ef1deca..1ae6030 100644 --- a/game/Assets/Scripts/PressurePlate/Door/trash.meta +++ b/game/Assets/Animation/Pressure Plate Door.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9bf3b1aee4a35624fb362b0eb39aee0d +guid: a83e60c9d68fae743b136228f931c5a1 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/game/Assets/Scripts/PressurePlate/Door.meta b/game/Assets/Animation/Pressure Plate Door/Door.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/Door.meta rename to game/Assets/Animation/Pressure Plate Door/Door.meta diff --git a/game/Assets/Scripts/PressurePlate/Door/Door.controller b/game/Assets/Animation/Pressure Plate Door/Door/Door.controller similarity index 100% rename from game/Assets/Scripts/PressurePlate/Door/Door.controller rename to game/Assets/Animation/Pressure Plate Door/Door/Door.controller diff --git a/game/Assets/Scripts/PressurePlate/Door/Door.controller.meta b/game/Assets/Animation/Pressure Plate Door/Door/Door.controller.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/Door/Door.controller.meta rename to game/Assets/Animation/Pressure Plate Door/Door/Door.controller.meta diff --git a/game/Assets/Scripts/PressurePlate/Door/DoorUp.anim b/game/Assets/Animation/Pressure Plate Door/Door/DoorUp.anim similarity index 100% rename from game/Assets/Scripts/PressurePlate/Door/DoorUp.anim rename to game/Assets/Animation/Pressure Plate Door/Door/DoorUp.anim diff --git a/game/Assets/Scripts/PressurePlate/Door/DoorUp.anim.meta b/game/Assets/Animation/Pressure Plate Door/Door/DoorUp.anim.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/Door/DoorUp.anim.meta rename to game/Assets/Animation/Pressure Plate Door/Door/DoorUp.anim.meta diff --git a/game/Assets/Scripts/PressurePlate/PP.meta b/game/Assets/Animation/Pressure Plate Door/Pressure Plate.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/PP.meta rename to game/Assets/Animation/Pressure Plate Door/Pressure Plate.meta diff --git a/game/Assets/Scripts/PressurePlate/PP/PPdown.anim b/game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPdown.anim similarity index 100% rename from game/Assets/Scripts/PressurePlate/PP/PPdown.anim rename to game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPdown.anim diff --git a/game/Assets/Scripts/PressurePlate/PP/PPdown.anim.meta b/game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPdown.anim.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/PP/PPdown.anim.meta rename to game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPdown.anim.meta diff --git a/game/Assets/Scripts/PressurePlate/PP/PPup.anim b/game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPup.anim similarity index 100% rename from game/Assets/Scripts/PressurePlate/PP/PPup.anim rename to game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPup.anim diff --git a/game/Assets/Scripts/PressurePlate/PP/PPup.anim.meta b/game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPup.anim.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/PP/PPup.anim.meta rename to game/Assets/Animation/Pressure Plate Door/Pressure Plate/PPup.anim.meta diff --git a/game/Assets/Scripts/PressurePlate/PP/Plate.controller b/game/Assets/Animation/Pressure Plate Door/Pressure Plate/Plate.controller similarity index 100% rename from game/Assets/Scripts/PressurePlate/PP/Plate.controller rename to game/Assets/Animation/Pressure Plate Door/Pressure Plate/Plate.controller diff --git a/game/Assets/Scripts/PressurePlate/PP/Plate.controller.meta b/game/Assets/Animation/Pressure Plate Door/Pressure Plate/Plate.controller.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/PP/Plate.controller.meta rename to game/Assets/Animation/Pressure Plate Door/Pressure Plate/Plate.controller.meta diff --git a/game/Assets/Animation/Animations.meta b/game/Assets/Animation/Screen.meta similarity index 100% rename from game/Assets/Animation/Animations.meta rename to game/Assets/Animation/Screen.meta diff --git a/game/Assets/Animation/Animations/BlackScreen.anim b/game/Assets/Animation/Screen/BlackScreen.anim similarity index 100% rename from game/Assets/Animation/Animations/BlackScreen.anim rename to game/Assets/Animation/Screen/BlackScreen.anim diff --git a/game/Assets/Animation/Animations/BlackScreen.anim.meta b/game/Assets/Animation/Screen/BlackScreen.anim.meta similarity index 100% rename from game/Assets/Animation/Animations/BlackScreen.anim.meta rename to game/Assets/Animation/Screen/BlackScreen.anim.meta diff --git a/game/Assets/Animation/Animations/Death(prototype).anim b/game/Assets/Animation/Screen/Death(prototype).anim similarity index 100% rename from game/Assets/Animation/Animations/Death(prototype).anim rename to game/Assets/Animation/Screen/Death(prototype).anim diff --git a/game/Assets/Animation/Animations/Death(prototype).anim.meta b/game/Assets/Animation/Screen/Death(prototype).anim.meta similarity index 100% rename from game/Assets/Animation/Animations/Death(prototype).anim.meta rename to game/Assets/Animation/Screen/Death(prototype).anim.meta diff --git a/game/Assets/Animation/Animations/fadeToBlack.anim b/game/Assets/Animation/Screen/fadeToBlack.anim similarity index 100% rename from game/Assets/Animation/Animations/fadeToBlack.anim rename to game/Assets/Animation/Screen/fadeToBlack.anim diff --git a/game/Assets/Animation/Animations/fadeToBlack.anim.meta b/game/Assets/Animation/Screen/fadeToBlack.anim.meta similarity index 100% rename from game/Assets/Animation/Animations/fadeToBlack.anim.meta rename to game/Assets/Animation/Screen/fadeToBlack.anim.meta diff --git a/game/Assets/Animation/Animations/fadeToClear.anim b/game/Assets/Animation/Screen/fadeToClear.anim similarity index 100% rename from game/Assets/Animation/Animations/fadeToClear.anim rename to game/Assets/Animation/Screen/fadeToClear.anim diff --git a/game/Assets/Animation/Animations/fadeToClear.anim.meta b/game/Assets/Animation/Screen/fadeToClear.anim.meta similarity index 100% rename from game/Assets/Animation/Animations/fadeToClear.anim.meta rename to game/Assets/Animation/Screen/fadeToClear.anim.meta diff --git a/game/Assets/Prefabs/PressurePlateDoor/DoorParent.prefab b/game/Assets/Prefabs/PressurePlateDoor/DoorParent.prefab index fea054f..2844601 100644 --- a/game/Assets/Prefabs/PressurePlateDoor/DoorParent.prefab +++ b/game/Assets/Prefabs/PressurePlateDoor/DoorParent.prefab @@ -124,6 +124,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 889410586990417773} + - component: {fileID: 8044731510911618503} m_Layer: 0 m_Name: DoorParent m_TagString: Untagged @@ -146,3 +147,16 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8044731510911618503 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7857540940252484938} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c79d6b66286a2ac41b41321a95dfcc00, type: 3} + m_Name: + m_EditorClassIdentifier: + _animator: {fileID: 7076099413930353623} diff --git a/game/Assets/Prefabs/PressurePlateDoor/PlateParent.prefab b/game/Assets/Prefabs/PressurePlateDoor/PlateParent.prefab index 5f8422e..7a15dc2 100644 --- a/game/Assets/Prefabs/PressurePlateDoor/PlateParent.prefab +++ b/game/Assets/Prefabs/PressurePlateDoor/PlateParent.prefab @@ -123,9 +123,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 17720070f47f28b4e8a87b8b071a79d0, type: 3} m_Name: m_EditorClassIdentifier: - doorDelay: 2 - pPlateAnim: {fileID: 0} - doorAnim: {fileID: 0} + _triggerDelay: 2 + pPlateAnim: {fileID: 8033591221754439421} + _onPress: + m_PersistentCalls: + m_Calls: [] --- !u!95 &8033591221754439421 Animator: serializedVersion: 3 diff --git a/game/Assets/Scenes/PressurePlate.unity b/game/Assets/Scenes/PressurePlate.unity index eaeb092..997a349 100644 --- a/game/Assets/Scenes/PressurePlate.unity +++ b/game/Assets/Scenes/PressurePlate.unity @@ -123,6 +123,17 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!114 &548252311 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 8044731510911618503, guid: 077e7025077de9f489adff0b8094a2ae, type: 3} + m_PrefabInstance: {fileID: 563802270} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c79d6b66286a2ac41b41321a95dfcc00, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &563802270 PrefabInstance: m_ObjectHideFlags: 0 @@ -201,7 +212,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.z - value: -0.01654972 + value: -0.016549727 objectReference: {fileID: 0} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalPosition.z @@ -209,19 +220,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.w - value: 0.7295202 + value: 0.72316897 objectReference: {fileID: 0} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.x - value: -0.012483184 + value: -0.012374505 objectReference: {fileID: 0} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.y - value: -0.68374527 + value: -0.69045925 objectReference: {fileID: 0} - target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.z - value: -0.011699907 + value: -0.011814794 objectReference: {fileID: 0} - target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_Name @@ -271,21 +282,33 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} + propertyPath: m_LocalPosition.x + value: -0.020135297 + objectReference: {fileID: 0} + - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} + propertyPath: m_LocalPosition.y + value: 0.16275719 + objectReference: {fileID: 0} + - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} + propertyPath: m_LocalPosition.z + value: -0.09517047 + objectReference: {fileID: 0} - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.w - value: 0.9778402 + value: 0.9839548 objectReference: {fileID: 0} - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.x - value: -0.13643865 + value: -0.07986162 objectReference: {fileID: 0} - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.y - value: 0.15792166 + value: 0.1574562 objectReference: {fileID: 0} - target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.z - value: -0.01654972 + value: -0.025743926 objectReference: {fileID: 0} - target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalPosition.z @@ -293,19 +316,19 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.w - value: 0.96863484 + value: 0.9705024 objectReference: {fileID: 0} - target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.x - value: -0.13515422 + value: -0.13541478 objectReference: {fileID: 0} - target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.y - value: 0.20738283 + value: 0.19838303 objectReference: {fileID: 0} - target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} propertyPath: m_LocalRotation.z - value: -0.021733113 + value: -0.020789955 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3} @@ -558,17 +581,36 @@ PrefabInstance: value: objectReference: {fileID: 1140283334} - target: {fileID: 5530170563008613136, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} - propertyPath: pPlateAnim + propertyPath: _onPress.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5530170563008613136, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} + propertyPath: _onPress.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5530170563008613136, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} + propertyPath: _onPress.m_PersistentCalls.m_Calls.Array.data[0].m_Target value: - objectReference: {fileID: 1606651177} + objectReference: {fileID: 548252311} + - target: {fileID: 5530170563008613136, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} + propertyPath: _onPress.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 5530170563008613136, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} + propertyPath: _onPress.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: Open + objectReference: {fileID: 0} + - target: {fileID: 5530170563008613136, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} + propertyPath: _onPress.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: Door, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 5530170563008613136, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} + propertyPath: _onPress.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} - target: {fileID: 8036033890208197765, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} propertyPath: m_Name value: PlateParent objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} ---- !u!95 &1606651177 stripped -Animator: - m_CorrespondingSourceObject: {fileID: 8033591221754439421, guid: 448321047f50e504cbc4586cf3eef27e, type: 3} - m_PrefabInstance: {fileID: 1505602105} - m_PrefabAsset: {fileID: 0} diff --git a/game/Assets/Scripts/PressurePlate/Door.cs b/game/Assets/Scripts/PressurePlate/Door.cs new file mode 100644 index 0000000..9f14c4e --- /dev/null +++ b/game/Assets/Scripts/PressurePlate/Door.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using UnityEngine; + +public class Door : MonoBehaviour +{ + [SerializeField] private Animator _animator; + + private bool _opened; + + public void Open() + { + if (_opened) return; + + // move door + _animator.Play("DoorUp", 0, 0); + _opened = true; + } +} diff --git a/game/Assets/Scripts/PressurePlate/Door.cs.meta b/game/Assets/Scripts/PressurePlate/Door.cs.meta new file mode 100644 index 0000000..6d63a1d --- /dev/null +++ b/game/Assets/Scripts/PressurePlate/Door.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c79d6b66286a2ac41b41321a95dfcc00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab b/game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab deleted file mode 100644 index bfbc217..0000000 --- a/game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab +++ /dev/null @@ -1,147 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &824688594051287168 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 824688594051287177} - - component: {fileID: 824688594051287182} - - component: {fileID: 824688594051287183} - - component: {fileID: 824688594051287180} - - component: {fileID: 824688594051287181} - - component: {fileID: 824688594051287171} - - component: {fileID: 824688594051287170} - m_Layer: 0 - m_Name: PressurePlate - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &824688594051287177 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 824688594051287168} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0.125, z: 0} - m_LocalScale: {x: 1, y: 0.25, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &824688594051287182 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 824688594051287168} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &824688594051287183 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 824688594051287168} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} ---- !u!65 &824688594051287180 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 824688594051287168} - 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!95 &824688594051287181 -Animator: - serializedVersion: 3 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 824688594051287168} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: 83928928fbe572c4b9ce8939f51f882c, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 ---- !u!65 &824688594051287171 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 824688594051287168} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 1, z: 0} ---- !u!114 &824688594051287170 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 824688594051287168} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 17720070f47f28b4e8a87b8b071a79d0, type: 3} - m_Name: - m_EditorClassIdentifier: - doorDelay: 2 - pPlateAnim: {fileID: 824688594051287181} - doorAnim: {fileID: 0} diff --git a/game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab.meta b/game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab.meta deleted file mode 100644 index cf69b1f..0000000 --- a/game/Assets/Scripts/PressurePlate/Door/trash/Plate.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0f9a05a61a7b0ec4c91a42bc927c5906 -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab b/game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab deleted file mode 100644 index 7e5e6d1..0000000 --- a/game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab +++ /dev/null @@ -1,99 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &2909796267397534871 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 997236398405830009} - m_Layer: 0 - m_Name: PressurePlate 1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &997236398405830009 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2909796267397534871} - 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: - - {fileID: 8418753010549425949} - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &9197628802269892500 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 997236398405830009} - m_Modifications: - - target: {fileID: 824688594051287168, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_Name - value: Plate - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalPosition.y - value: 0.125 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 824688594051287181, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - propertyPath: m_Controller - value: - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} ---- !u!4 &8418753010549425949 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 824688594051287177, guid: 0f9a05a61a7b0ec4c91a42bc927c5906, type: 3} - m_PrefabInstance: {fileID: 9197628802269892500} - m_PrefabAsset: {fileID: 0} diff --git a/game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab.meta b/game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab.meta deleted file mode 100644 index 3f5a276..0000000 --- a/game/Assets/Scripts/PressurePlate/Door/trash/PressurePlate 1.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: bc2200f701ede2f499d9e964e519675b -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/game/Assets/Scripts/PressurePlate/PressurePlateScript.cs b/game/Assets/Scripts/PressurePlate/PressurePlate.cs similarity index 74% rename from game/Assets/Scripts/PressurePlate/PressurePlateScript.cs rename to game/Assets/Scripts/PressurePlate/PressurePlate.cs index 48303bd..0c43056 100644 --- a/game/Assets/Scripts/PressurePlate/PressurePlateScript.cs +++ b/game/Assets/Scripts/PressurePlate/PressurePlate.cs @@ -1,15 +1,16 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Events; -public class PressurePlateScript : MonoBehaviour +public class PressurePlate : MonoBehaviour { - private float? triggered = null; - [SerializeField] private float doorDelay = 2.0f; - private bool opened = false; - + [SerializeField] private float _triggerDelay = 2.0f; [SerializeField] private Animator pPlateAnim = null; - [SerializeField] private Animator doorAnim = null; + [SerializeField] private UnityEvent _onPress; + + private bool opened = false; + private float? triggered = null; private void OnTriggerEnter(Collider other) { @@ -38,12 +39,9 @@ public class PressurePlateScript : MonoBehaviour { var timepassed = Time.time - triggered; - if(timepassed > doorDelay && !opened) + if(timepassed > _triggerDelay && !opened) { - //move door - doorAnim.Play("DoorUp", 0, 0f); - opened = true; - + _onPress.Invoke(); } } } \ No newline at end of file diff --git a/game/Assets/Scripts/PressurePlate/PressurePlateScript.cs.meta b/game/Assets/Scripts/PressurePlate/PressurePlate.cs.meta similarity index 100% rename from game/Assets/Scripts/PressurePlate/PressurePlateScript.cs.meta rename to game/Assets/Scripts/PressurePlate/PressurePlate.cs.meta