Scriptum/Assets/Scripts/REFACTORING/Story/Cementary/TombstoneDoorBlock.cs
2023-01-14 22:38:58 +01:00

46 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TombstoneDoorBlock : MonoBehaviour
{
public GameObject bars;
// Start is called before the first frame update
void Start()
{
bars = GameObject.Find("CatacombsDoor");
}
// Update is called once per frame
void Update()
{
string tomb1 = PlayerPrefs.GetString("tombstone2");
string tomb3 = PlayerPrefs.GetString("tombstone3");
string tomb5 = PlayerPrefs.GetString("tombstone6");
string tomb6 = PlayerPrefs.GetString("tombstone1");
string tomb8 = PlayerPrefs.GetString("tombstone9");
if (tomb1 == "left" && tomb3 == "left" && tomb5 == "right" && tomb6 == "bottom" && tomb8 == "right")
{
if (gameObject.GetComponent<DoorBehaviour>())
gameObject.GetComponent<DoorBehaviour>().isEnabled = true;
if (gameObject.GetComponent<AnimatedDoorBehaviour>())
gameObject.GetComponent<AnimatedDoorBehaviour>().isEnabled = true;
bars.SetActive(false);
}
else
{
if (gameObject.GetComponent<DoorBehaviour>())
gameObject.GetComponent<DoorBehaviour>().isEnabled = false;
if (gameObject.GetComponent<AnimatedDoorBehaviour>())
gameObject.GetComponent<AnimatedDoorBehaviour>().isEnabled = false;
bars.SetActive(true);
}
}
}