Skip to content
Snippets Groups Projects
TutorialMessageController.cs 1.16 KiB
Newer Older
Moritz Meyerhof's avatar
Moritz Meyerhof committed
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

Moritz Meyerhof's avatar
Moritz Meyerhof committed
public class TutorialMessageController : MonoBehaviour
{
    [SerializeField] List<string> keyTut;
Moritz Meyerhof's avatar
Moritz Meyerhof committed
    [SerializeField] List<GameObject> messagesTut;

    [SerializeField] GameObject textPrefab;
    GameObject activeMessage = null;
Moritz Meyerhof's avatar
Moritz Meyerhof committed
    Dictionary<string, GameObject> messages = new Dictionary<string, GameObject>();

    GameObject canvas;

    private void Awake()
Moritz Meyerhof's avatar
Moritz Meyerhof committed
    {
Moritz Meyerhof's avatar
Moritz Meyerhof committed
        canvas = GameObject.FindGameObjectWithTag("MainCanvas");
        //Camera.main.GetComponent<BaseCameraController>().SetUserControlEnabled(false);
        
        //create Dict with Structs
        for (int i = 0; i < keyTut.Count; i++)
        {
Moritz Meyerhof's avatar
Moritz Meyerhof committed
            messages.Add(keyTut[i],messagesTut[i]);
Moritz Meyerhof's avatar
Moritz Meyerhof committed
    }

    public void ActivateTutorial(string tutorialType)
Moritz Meyerhof's avatar
Moritz Meyerhof committed
    {
        if ( activeMessage != null)
        {
Moritz Meyerhof's avatar
Moritz Meyerhof committed
            activeMessage.SetActive(false);
        }
        if ( tutorialType == "return")
        {
            SceneLoader.instance.LoadScene("Forest");
            return;
        }
Moritz Meyerhof's avatar
Moritz Meyerhof committed
        activeMessage = messages[tutorialType];
        activeMessage.SetActive(true);
Moritz Meyerhof's avatar
Moritz Meyerhof committed
    }
Moritz Meyerhof's avatar
Moritz Meyerhof committed
}