LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/KeyItem.cs
2023-12-22 18:30:10 -05:00

27 lines
745 B
C#

using UnityEngine;
public class KeyItem : GrabbableObject
{
public override void ItemActivate(bool used, bool buttonDown = true)
{
if (!(playerHeldBy == null) && base.IsOwner && Physics.Raycast(new Ray(playerHeldBy.gameplayCamera.transform.position, playerHeldBy.gameplayCamera.transform.forward), out var hitInfo, 3f, 2816))
{
DoorLock component = hitInfo.transform.GetComponent<DoorLock>();
if (component != null && component.isLocked && !component.isPickingLock)
{
component.UnlockDoorSyncWithServer();
playerHeldBy.DespawnHeldObject();
}
}
}
protected override void __initializeVariables()
{
base.__initializeVariables();
}
protected internal override string __getTypeName()
{
return "KeyItem";
}
}