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.
42 lines
842 B
42 lines
842 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()
|
|
{
|
|
if (point)
|
|
{
|
|
InteractionManager.LocalPlayer.Movement?.MoveTo(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;
|
|
}
|
|
|
|
}
|
|
|