use events to link plate and door

also removed unnecessary prefabs and moved animations to animation
folder
This commit is contained in:
Cat Flynn 2021-04-15 15:10:58 +01:00
parent 577070a551
commit 85fe992fa1
33 changed files with 122 additions and 295 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9bf3b1aee4a35624fb362b0eb39aee0d
guid: a83e60c9d68fae743b136228f931c5a1
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -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}

View File

@ -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

View File

@ -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}

View File

@ -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;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c79d6b66286a2ac41b41321a95dfcc00
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 0f9a05a61a7b0ec4c91a42bc927c5906
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: bc2200f701ede2f499d9e964e519675b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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();
}
}
}