LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/KeyItem.cs

28 lines
745 B
C#
Raw Normal View History

2023-12-22 22:51:17 +00:00
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";
}
}