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.
43 lines
897 B
43 lines
897 B
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
[Serializable]
|
|
public class Interaction
|
|
{
|
|
[SerializeField] protected bool active = true;
|
|
|
|
[SerializeField] protected InteractionButton button;
|
|
[SerializeField] protected GameObject point;
|
|
[SerializeField] protected UnityEvent onAction;
|
|
|
|
public bool Active => active;
|
|
|
|
public void Action()
|
|
{
|
|
InteractionManager.Instance.Deactivate();
|
|
if (point)
|
|
{
|
|
InteractionManager.LocalPlayer.Movement?.MoveToBlock(point.transform.position, PostAction);
|
|
}
|
|
else
|
|
{
|
|
PostAction();
|
|
}
|
|
}
|
|
private void PostAction()
|
|
{
|
|
onAction?.Invoke();
|
|
}
|
|
|
|
public virtual void InitializeButton(Vector3 pos)
|
|
{
|
|
button.Initialize(this, pos);
|
|
}
|
|
|
|
public void SetActive(bool active)
|
|
{
|
|
this.active = active;
|
|
}
|
|
|
|
}
|
|
|