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.
34 lines
817 B
34 lines
817 B
using UnityEngine;
|
|
using UnityEngine.U2D;
|
|
using UnityEngine.UI;
|
|
|
|
public class InteractionButton : MonoBehaviour
|
|
{
|
|
[SerializeField, ReadOnly] private Interaction interaction;
|
|
[SerializeField] private Button button;
|
|
[SerializeField] private Image image;
|
|
|
|
public void Action()
|
|
{
|
|
InteractionManager.Instance.Deactivate();
|
|
interaction?.Action();
|
|
}
|
|
|
|
public void Initialize(Interaction interaction, Vector3 pos)
|
|
{
|
|
this.interaction = interaction;
|
|
transform.position = pos;
|
|
SetActive(true);
|
|
}
|
|
|
|
public void Initialize(Interaction interaction, Vector3 pos, Sprite sprite)
|
|
{
|
|
this.interaction = interaction;
|
|
image.sprite = sprite;
|
|
}
|
|
|
|
public void SetActive(bool active)
|
|
{
|
|
gameObject.SetActive(active);
|
|
}
|
|
}
|
|
|