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

24 lines
479 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(1);
}
}