50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using PixelCrushers.DialogueSystem;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class SimpleRotisserieController : MonoBehaviour
|
|
{
|
|
[SerializeField] private bool m_readyToGather;
|
|
[SerializeField] private int m_MeatID;
|
|
[SerializeField] private int m_amountToGet = 5;
|
|
|
|
[SerializeField] private GameObject m_RoastingTrigger;
|
|
[SerializeField] private GameObject m_GatheringTrigger;
|
|
[SerializeField] private GameObject m_MeatGameObject;
|
|
|
|
[SerializeField] private UnityEvent OnMeatGather;
|
|
|
|
public void MeatReady()
|
|
{
|
|
m_readyToGather = true;
|
|
m_RoastingTrigger.SetActive(!m_readyToGather);
|
|
m_GatheringTrigger.SetActive(m_readyToGather);
|
|
}
|
|
|
|
public void TryGetMeat()
|
|
{
|
|
if (!m_MeatGameObject.activeSelf)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!m_readyToGather)
|
|
{
|
|
DialogueManager.instance.BarkString("I should rotate this meat.", Player.Instance.transform);
|
|
return;
|
|
}
|
|
|
|
m_readyToGather = false;
|
|
m_MeatGameObject.SetActive(false);
|
|
Player.Instance.ItemManager.AddItemsByID(m_MeatID, m_amountToGet);
|
|
OnMeatGather?.Invoke();
|
|
m_RoastingTrigger.SetActive(m_readyToGather);
|
|
m_GatheringTrigger.SetActive(m_readyToGather);
|
|
}
|
|
}
|
|
} |