31 lines
1.3 KiB
C#
31 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class EatMeatStep : MonoBehaviour
|
|
{
|
|
public BaseStepController baseStepController;
|
|
|
|
private bool hasUpdatedHealth = false;
|
|
public List<Button> buttonsToDisable;
|
|
public Button consumeButton;
|
|
|
|
// Start is called before the first frame update
|
|
private void Start()
|
|
{
|
|
baseStepController.OnStarted += () => { buttonsToDisable.ForEach(button => button.enabled = false); Player.Instance.ThirdPersonController.onChangeHealth.AddListener(MarkAsHPUpdated); };
|
|
baseStepController.ConditionsAreMet += () => hasUpdatedHealth;
|
|
baseStepController.OnCompletedStart += () => { Player.Instance.ItemManager.AddItemsByID(83, 3); Player.Instance.ItemManager.AddItemsByID(84, 3); consumeButton.enabled = false; };
|
|
// baseStepController.OnCompleted += () => { /*buttonsToDisable.ForEach(button => button.enabled = true);*/ consumeButton.enabled = false; };
|
|
}
|
|
|
|
public void MarkAsHPUpdated(float value)
|
|
{
|
|
hasUpdatedHealth = true;
|
|
Player.Instance.ThirdPersonController.onChangeHealth.RemoveListener(MarkAsHPUpdated);
|
|
}
|
|
}
|
|
} |