only allow using elevator while on it

This commit is contained in:
2023-05-15 09:13:12 +02:00
parent 8de8301205
commit 0d451302e0
5 changed files with 67 additions and 27 deletions

View File

@@ -1471,14 +1471,14 @@ Transform:
- {fileID: 604728745} - {fileID: 604728745}
- {fileID: 681930983} - {fileID: 681930983}
- {fileID: 6067357455631746734} - {fileID: 6067357455631746734}
- {fileID: 1853180256}
- {fileID: 1949077063} - {fileID: 1949077063}
- {fileID: 1532540192886921385} - {fileID: 1532540192886921385}
- {fileID: 3750376657174321754}
- {fileID: 2343402481646314946}
- {fileID: 1853180256}
- {fileID: 675198211105780961} - {fileID: 675198211105780961}
- {fileID: 538618498} - {fileID: 538618498}
- {fileID: 9336441} - {fileID: 9336441}
- {fileID: 3750376657174321754}
- {fileID: 2343402481646314946}
m_Father: {fileID: 1340421038} m_Father: {fileID: 1340421038}
m_RootOrder: -1 m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -1498,7 +1498,7 @@ PrefabInstance:
- target: {fileID: 4465959117638929429, guid: 7e73939d683dfbd41b3d359167a157cd, - target: {fileID: 4465959117638929429, guid: 7e73939d683dfbd41b3d359167a157cd,
type: 3} type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 5.0000005 value: 5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4465959117638929429, guid: 7e73939d683dfbd41b3d359167a157cd, - target: {fileID: 4465959117638929429, guid: 7e73939d683dfbd41b3d359167a157cd,
type: 3} type: 3}
@@ -3246,7 +3246,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!4 &1340421038 --- !u!4 &1340421038
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -3694,7 +3694,7 @@ PrefabInstance:
- target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514, - target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 0 value: -1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514, - target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514,
type: 3} type: 3}
@@ -3719,17 +3719,17 @@ PrefabInstance:
- target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514, - target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514,
type: 3} type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0 value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514, - target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514,
type: 3} type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0 value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514, - target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514,
type: 3} type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: 0 value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514, - target: {fileID: 2216350971831476633, guid: 7854eeba0cc4ea4419f74ce50bc9c514,
type: 3} type: 3}

View File

@@ -153,7 +153,7 @@ Transform:
- {fileID: 852813185195933073} - {fileID: 852813185195933073}
- {fileID: 979859350274255980} - {fileID: 979859350274255980}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: -1 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7351803888791370729 --- !u!1 &7351803888791370729
GameObject: GameObject:
@@ -285,8 +285,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 352860bb2c6549d0b3e84104afef3f54, type: 3} m_Script: {fileID: 11500000, guid: 352860bb2c6549d0b3e84104afef3f54, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
hideWhenDisabled: 0 hideWhenDisabled: 1
startInactive: 0 startInactive: 1
holoRenderer: {fileID: 7222608493507710839} holoRenderer: {fileID: 7222608493507710839}
--- !u!114 &3852086329416498098 --- !u!114 &3852086329416498098
MonoBehaviour: MonoBehaviour:

View File

@@ -8,20 +8,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 874298466439840366, guid: 866e3516e2f8502408e17cb19c4e57cc,
type: 3}
propertyPath: startInactive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 874298466439840366, guid: 866e3516e2f8502408e17cb19c4e57cc,
type: 3}
propertyPath: hideWhenDisabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1223383990908721599, guid: 866e3516e2f8502408e17cb19c4e57cc, - target: {fileID: 1223383990908721599, guid: 866e3516e2f8502408e17cb19c4e57cc,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: -1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1223383990908721599, guid: 866e3516e2f8502408e17cb19c4e57cc, - target: {fileID: 1223383990908721599, guid: 866e3516e2f8502408e17cb19c4e57cc,
type: 3} type: 3}

View File

@@ -43,7 +43,8 @@ GameObject:
- component: {fileID: 8648774459861283546} - component: {fileID: 8648774459861283546}
- component: {fileID: 716647553232511872} - component: {fileID: 716647553232511872}
- component: {fileID: 2841556225424433569} - component: {fileID: 2841556225424433569}
m_Layer: 0 - component: {fileID: 5292547662050914046}
m_Layer: 7
m_Name: Elevator m_Name: Elevator
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@@ -101,6 +102,27 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0 m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0 m_WriteDefaultValuesOnDisable: 0
--- !u!65 &5292547662050914046
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1636625108852260585}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 2, z: 1}
m_Center: {x: 0, y: 1, z: 0}
--- !u!1 &2903613370134496792 --- !u!1 &2903613370134496792
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -272,7 +294,7 @@ Transform:
- {fileID: 6915102081068721723} - {fileID: 6915102081068721723}
- {fileID: 4453669748914392433} - {fileID: 4453669748914392433}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: -1 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &6525843738508825059 --- !u!114 &6525843738508825059
MonoBehaviour: MonoBehaviour:

View File

@@ -8,7 +8,7 @@ using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
namespace Station46.Modules.Elevated_Platform.Scripts namespace Station46.Modules.Elevated_Platform.Scripts
{ {
[RequireComponent(typeof(Animator))] [RequireComponent(typeof(Animator), typeof(Collider))]
public class PlatformElevator : MonoBehaviour public class PlatformElevator : MonoBehaviour
{ {
public enum Status public enum Status
@@ -34,7 +34,11 @@ namespace Station46.Modules.Elevated_Platform.Scripts
case Status.Bottom: case Status.Bottom:
case Status.Top: case Status.Top:
ReleasePlayer(); ReleasePlayer();
if (!_leftElevatorWhileMoving)
{
_button.Enable(); _button.Enable();
}
_leftElevatorWhileMoving = false;
break; break;
case Status.Moving: case Status.Moving:
_button.Disable(); _button.Disable();
@@ -49,6 +53,7 @@ namespace Station46.Modules.Elevated_Platform.Scripts
private Status _status = Status.Bottom; private Status _status = Status.Bottom;
private Animator _animator; private Animator _animator;
private Transform _previousPlayerParent; private Transform _previousPlayerParent;
private bool _leftElevatorWhileMoving;
private void Awake() private void Awake()
{ {
@@ -104,5 +109,28 @@ namespace Station46.Modules.Elevated_Platform.Scripts
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
} }
private void OnTriggerEnter(Collider other)
{
if (_status != Status.Moving && other.CompareTag("MainCamera"))
{
_button.Enable();
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("MainCamera"))
{
if (_status == Status.Moving)
{
_leftElevatorWhileMoving = true;
}
else
{
_button.Disable();
}
}
}
} }
} }