80 lines
2.6 KiB
C#
80 lines
2.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace InfallibleCode
|
|
{
|
|
public class GetLamp : MonoBehaviour, IInteractable
|
|
{
|
|
#region OLD
|
|
//public Transform BulbHolderPOS;
|
|
//public Transform Bulb;
|
|
//public Vector3 _Item3DDefaultPos;
|
|
//public float _lerpItem;
|
|
//public bool HasLampInHands;
|
|
#endregion
|
|
|
|
LightBulbEmissionUpdate lightBulbEmissionUpdate;
|
|
[SerializeField] private LeaveLampInHolder leaveLampInHolder;
|
|
public Light[] BulbLight;
|
|
public SanityActivation SanityActivation;
|
|
|
|
private void Awake()
|
|
{
|
|
lightBulbEmissionUpdate = GetComponent<LightBulbEmissionUpdate>();
|
|
|
|
if ((transform.GetComponentInParent<LeaveLampInHolder>()) != null)
|
|
{
|
|
leaveLampInHolder = GetComponentInParent<LeaveLampInHolder>();
|
|
}
|
|
else
|
|
{
|
|
leaveLampInHolder = null;
|
|
}
|
|
|
|
BulbLight = GetComponentsInChildren<Light>();
|
|
SanityActivation = GetComponentInChildren<SanityActivation>();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
|
|
}
|
|
|
|
public void LampUpdate()
|
|
{
|
|
#region OLD
|
|
//if (!ItemsInHandsData.GetInstance().HasLampInHands)
|
|
//{
|
|
// StopAllCoroutines();
|
|
// StartCoroutine(GetLamp());
|
|
//}
|
|
//else
|
|
//{
|
|
// StopAllCoroutines();
|
|
// StartCoroutine(LeaveLamp());
|
|
//}
|
|
#endregion
|
|
if (!ItemsInHandsData.GetInstance().HasLampInHands && ItemsInHandsData.GetInstance().CanGetLamp)
|
|
{
|
|
ItemsInHandsData.GetInstance().CurrentBulbSanityActivation = SanityActivation;
|
|
ItemsInHandsData.GetInstance().CurrentLightBulbEmissionUpdate = lightBulbEmissionUpdate;
|
|
ItemsInHandsData.GetInstance().ChangeBulb_LerpItem = 0f;
|
|
ItemsInHandsData.GetInstance().CurrentBulb = transform;
|
|
for (int i = 0; i < BulbLight.Length; i++)
|
|
{
|
|
ItemsInHandsData.GetInstance().CurrentBulbLight.Add(BulbLight[i]);
|
|
}
|
|
ItemsInHandsData.GetInstance().StopAllCoroutines();
|
|
ItemsInHandsData.GetInstance().StartCoroutine(ItemsInHandsData.GetInstance().GetLamp());
|
|
ItemsInHandsData.GetInstance().CanGetLamp = false;
|
|
}
|
|
}
|
|
|
|
public void Interact()
|
|
{
|
|
LampUpdate();
|
|
}
|
|
}
|
|
}
|