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.
48 lines
1.1 KiB
48 lines
1.1 KiB
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
[Serializable]
|
|
public class Interaction
|
|
{
|
|
[SerializeField] protected bool active = true;
|
|
|
|
[SerializeField] protected InteractionButton button;
|
|
[SerializeField] protected GameObject goToPoint;
|
|
[SerializeField] protected Vector3 rotation;
|
|
[SerializeField] protected GameObject finishPoint;
|
|
[SerializeField] protected UnityEvent onAction;
|
|
|
|
public Vector3 Rotation => rotation;
|
|
|
|
public GameObject GoToPoint => goToPoint;
|
|
public GameObject FinishPoint => finishPoint;
|
|
public bool Active => active;
|
|
|
|
public void Action()
|
|
{
|
|
if (goToPoint)
|
|
{
|
|
InteractionManager.LocalPlayer.Movement?.MoveTo(goToPoint.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;
|
|
}
|
|
|
|
}
|
|
|