106 lines
3.1 KiB
C#
106 lines
3.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using InfallibleCode;
|
|
|
|
public class LampsSequence : MonoBehaviour
|
|
{
|
|
private static LampsSequence _instance;
|
|
public static LampsSequence GetInstance() { return _instance; }
|
|
|
|
public int DrawingsCollectedID;
|
|
public int DrawingsPlacedInWallID;
|
|
[HideInInspector] public bool UpdateItemIndex;
|
|
|
|
|
|
[Header("Drawings Data")]
|
|
//public bool HasLetter;
|
|
//public bool HasDrawingBathroom;
|
|
//public bool HasDrawingByeMom;
|
|
//public bool HasDrawingReveal;
|
|
|
|
public int ItemID;
|
|
//public int[] DrawingBathroomID;
|
|
//public int[] DrawingByeMomID;
|
|
//public int[] DrawingRevealID;
|
|
private bool phoneAnswered;
|
|
[SerializeField] private GameObject phone;
|
|
[SerializeField] private ExaminableItem phoneExaminableItem;
|
|
|
|
void Awake()
|
|
{
|
|
if (!_instance)
|
|
{
|
|
_instance = this;
|
|
}
|
|
phone = GameObject.Find("Phone_pickup (LampSequence)");
|
|
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
phoneExaminableItem = phone.GetComponent<ExaminableItem>();
|
|
}
|
|
|
|
public enum LampsSequenceState
|
|
{
|
|
FindDrawings,
|
|
DrawingsPlace,
|
|
DestroyWall,
|
|
PhoneAnswered
|
|
|
|
}
|
|
|
|
public void Update() //TESTING DELETE AND ACCESS FROM GAME MANAGER.
|
|
{
|
|
LampsSequenceStoryline();
|
|
}
|
|
|
|
public LampsSequenceState lampsSequenceState = LampsSequenceState.FindDrawings;
|
|
|
|
public void LampsSequenceStoryline()
|
|
{
|
|
switch (lampsSequenceState)
|
|
{
|
|
case LampsSequenceState.FindDrawings:
|
|
//if ()
|
|
//{
|
|
// Sanity.GetInstance().SanityChangeMaxValueAtRuntime(100f);
|
|
//}
|
|
|
|
if (DrawingsCollectedID == 4)
|
|
{
|
|
lampsSequenceState = LampsSequenceState.DrawingsPlace;
|
|
}
|
|
break;
|
|
case LampsSequenceState.DrawingsPlace:
|
|
if(DrawingsPlacedInWallID == 4)
|
|
{
|
|
GameObject.Find("Basement_plain_LampsSequence").SetActive(false);
|
|
lampsSequenceState = LampsSequenceState.DestroyWall;
|
|
}
|
|
break;
|
|
case LampsSequenceState.DestroyWall:
|
|
if (phoneExaminableItem.HasInteractedWithItem)
|
|
{
|
|
phoneAnswered = true;
|
|
lampsSequenceState = LampsSequenceState.PhoneAnswered;
|
|
Debug.Log("Phone answered");
|
|
}
|
|
break;
|
|
case LampsSequenceState.PhoneAnswered:
|
|
if (phoneAnswered)
|
|
{
|
|
GameObject lampsSequencePuzzleRooms = GameObject.Find("LampsSequencePuzzleRooms");
|
|
lampsSequencePuzzleRooms.SetActive(false);
|
|
GameObject EvenTriggerPhoneRoom = GameObject.Find("EvenTrigger (PhoneRoom)");
|
|
EvenTriggerPhoneRoom.GetComponent<EventTrigger>().Invoke();
|
|
phoneAnswered = false;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|