50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class EquipCovertGazeStep : MonoBehaviour
|
|
{
|
|
private const int scrollItemID = 43;
|
|
public MenuScroll menuScroll;
|
|
public BaseStepController baseStepController;
|
|
public bEquipArea equipArea;
|
|
private List<bEquipSlot> equipSlots;
|
|
private bool scrollEquipped = false;
|
|
|
|
private void Start()
|
|
{
|
|
// equipSlots = equipArea.equipSlots;
|
|
baseStepController.OnStarted += () => { Player.Instance.ItemManager.onEquipItem.AddListener(TryToMarkAsGazeEquipped); /*UnequipAxe();*/ };
|
|
baseStepController.OnEvaluationStart += () => { CheckIfGazeIsAlreadyEquipped(); };
|
|
baseStepController.ConditionsAreMet += () => scrollEquipped;
|
|
baseStepController.OnCompleted += () => CloseMenu();
|
|
}
|
|
|
|
public void CloseMenu()
|
|
{
|
|
menuScroll.CloseScroll();
|
|
}
|
|
|
|
public void CheckIfGazeIsAlreadyEquipped()
|
|
{
|
|
//in case player equips the sword before the check begins
|
|
if (equipArea.equipSlots.Find(slot => slot.item && slot.item.id == scrollItemID))
|
|
{
|
|
scrollEquipped = true;
|
|
Player.Instance.ItemManager.onEquipItem.RemoveListener(TryToMarkAsGazeEquipped);
|
|
}
|
|
}
|
|
|
|
private void TryToMarkAsGazeEquipped(bEquipArea area, bItem item)
|
|
{
|
|
if (item.id == scrollItemID)
|
|
{
|
|
scrollEquipped = true;
|
|
}
|
|
Player.Instance.ItemManager.onEquipItem.RemoveListener(TryToMarkAsGazeEquipped);
|
|
}
|
|
}
|
|
} |