50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using InfallibleCode;
|
|
|
|
public class FuseBoxLeverPickUp : MonoBehaviour
|
|
{
|
|
public ExaminableItem examinableItem;
|
|
public bool hasLever;
|
|
public MeshRenderer _leverGameObject;
|
|
|
|
void Start()
|
|
{
|
|
_leverGameObject = GetComponentInChildren<MeshRenderer>();
|
|
examinableItem = GetComponent<ExaminableItem>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
PickUpLever();
|
|
}
|
|
|
|
void PickUpLever()
|
|
{
|
|
if (examinableItem.examineItem.CanPressButtonToGetItem && examinableItem.examineItem.CurrenltyExaminingObj)
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.E))
|
|
{
|
|
hasLever = true;
|
|
examinableItem.examineItem.CanPressButtonToGetItem = false;
|
|
StartCoroutine(PickingUpObject());
|
|
|
|
#region Debugging
|
|
print("You picked up the lever!");
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
|
|
IEnumerator PickingUpObject()
|
|
{
|
|
_leverGameObject.enabled = false;
|
|
yield return new WaitForSecondsRealtime(0.1f);
|
|
examinableItem.examineItem.GotItemExitDisplayingItem3d();
|
|
yield return new WaitForSecondsRealtime(0.1f);
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
}
|