Skip to content

Commit

Permalink
Fixed key pickups sometimes not triggering (#227)
Browse files Browse the repository at this point in the history
* Fixed key pickups sometimes not triggering

* Removed debug logging on Key class
  • Loading branch information
CalmPewter committed Dec 15, 2023
1 parent 6e037ab commit c2cea6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 43 deletions.
52 changes: 10 additions & 42 deletions Assets/_Project/Prefabs/Spawnables/Key.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ GameObject:
- component: {fileID: 405373317742123834}
- component: {fileID: 1915836774641855264}
- component: {fileID: 3211521776662913546}
- component: {fileID: 4846096333415965450}
- component: {fileID: 2377469935815218961}
m_Layer: 11
m_Name: Item
m_TagString: Key
Expand Down Expand Up @@ -216,7 +218,7 @@ Rigidbody2D:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3483368467624999901}
m_BodyType: 2
m_BodyType: 1
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
Expand Down Expand Up @@ -5023,7 +5025,7 @@ MonoBehaviour:
pickupSound: {fileID: 8300000, guid: d55aac4483d169c46abc82cc903b0f4d, type: 3}
bootySound: {fileID: 8300000, guid: 5147ae6427843234c834fe1d4c329ac4, type: 3}
animator: {fileID: 3211521776662913546}
collider: {fileID: 1946309759202882616}
collider: {fileID: 4846096333415965450}
--- !u!95 &3211521776662913546
Animator:
serializedVersion: 5
Expand All @@ -5045,46 +5047,13 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!1 &8298303427631752500
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5555052231711724651}
- component: {fileID: 1946309759202882616}
- component: {fileID: 998666886426722209}
m_Layer: 11
m_Name: Trigger
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5555052231711724651
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8298303427631752500}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1893953542598176481}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &1946309759202882616
--- !u!61 &4846096333415965450
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8298303427631752500}
m_GameObject: {fileID: 3483368467624999901}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
Expand All @@ -5095,22 +5064,22 @@ BoxCollider2D:
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 2, y: 4}
newSize: {x: 2, y: 4}
oldSize: {x: 0.75, y: 0.75}
newSize: {x: 2, y: 1.09375}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.55, y: 1}
m_EdgeRadius: 0
--- !u!114 &998666886426722209
--- !u!114 &2377469935815218961
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8298303427631752500}
m_GameObject: {fileID: 3483368467624999901}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 69aca26f4f2961147a7a3dfafff370b3, type: 3}
Expand Down Expand Up @@ -5147,7 +5116,6 @@ Transform:
m_Children:
- {fileID: 4889487954803800287}
- {fileID: 767155436777887569}
- {fileID: 5555052231711724651}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
2 changes: 1 addition & 1 deletion Assets/_Project/Scripts/Gameplay/Key.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void FinishPickup()

public void Trigger(Transform transform)
{
if (!transform.TryGetComponent<PlayerController>(out PlayerController player))
if (!transform.TryGetComponent<PlayerController>(out PlayerController player) || _isCollected)
return;

PickUp();
Expand Down

0 comments on commit c2cea6a

Please sign in to comment.