You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RatAttack2D/Assets/Scripts/Interactable.cs

37 lines
723 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class Interactable : MonoBehaviour
{
public int option;
public void Interact()
{
var type = typeof(Interactable);
var e = type.GetMethod("M"+option.ToString());
if(e == null)
{
return;
}
e.Invoke(this, null);
}
public void M0()
{
SceneManager.LoadScene(2);
}
public void M1()
{
gbs.Shop.SetActive(true);
}
}
public static class gbs
{
public static GameObject Shop;
public static void Start()
{
Shop = GameObject.Find("Shop");
Shop.SetActive(false);
}
}