Add missing file to block door
This commit is contained in:
parent
486e5e58c7
commit
946eb8f9dd
@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[RequireComponent(typeof(WindowController))]
|
||||||
|
class WizardLetter : MonoBehaviour
|
||||||
|
{
|
||||||
|
public Item RequiredObject;
|
||||||
|
|
||||||
|
public bool decided = false;
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if(!decided)
|
||||||
|
{
|
||||||
|
if (InventoryUIManager.Instance != null && InventoryUIManager.Instance.FindItemInWarehouseByName(RequiredObject.name).Count > 0)
|
||||||
|
{
|
||||||
|
if (gameObject.GetComponent<DoorBehaviour>())
|
||||||
|
gameObject.GetComponent<DoorBehaviour>().isEnabled = false;
|
||||||
|
|
||||||
|
if (gameObject.GetComponent<AnimatedDoorBehaviour>())
|
||||||
|
gameObject.GetComponent<AnimatedDoorBehaviour>().isEnabled = false;
|
||||||
|
|
||||||
|
decided = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DANGEROUS - we make sure that dorwont be opened by force - work only when on the scene there is only one door!!!
|
||||||
|
if (gameObject.GetComponent<AnimatedDoorBehaviour>().isEnabled == false)
|
||||||
|
TriggerDoor.ableToOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerEnter2D(Collider2D collision)
|
||||||
|
{
|
||||||
|
if (!gameObject.GetComponent<WindowController>().IsOpened() && InventoryUIManager.Instance.FindItemInWarehouseByName(RequiredObject.name).Count > 0)
|
||||||
|
gameObject.GetComponent<WindowController>().OpenPanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerExit2D(Collider2D collision)
|
||||||
|
{
|
||||||
|
if (gameObject.GetComponent<WindowController>().IsOpened())
|
||||||
|
gameObject.GetComponent<WindowController>().DestroyPanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 882134c91e77a0f4b913091e3ef95538
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user