49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using UnityEngine;
|
|
|
|
|
|
public class InteractionManager : MonoBehaviour
|
|
{
|
|
private static InteractionManager instance;
|
|
|
|
private CommandHandler commandHandler;
|
|
private GhostManagerV2 ghostManager;
|
|
private SelectionManager selectionManager;
|
|
private UIManager uiManager;
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance == null) instance = this;
|
|
else Destroy(this.gameObject);
|
|
}
|
|
|
|
public static InteractionManager getInstance()
|
|
{
|
|
return instance;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
commandHandler = CommandHandler.getInstance();
|
|
ghostManager = GhostManagerV2.getInstance();
|
|
selectionManager = SelectionManager.getInstance();
|
|
uiManager = UIManager.getInstance();
|
|
|
|
setupListeners();
|
|
}
|
|
|
|
private void setupListeners()
|
|
{
|
|
uiManager.onSelectEvent.AddListener(blockData =>
|
|
{
|
|
ghostManager.setupBlock(blockData);
|
|
});
|
|
ghostManager.onClearAddListener(() =>
|
|
{
|
|
uiManager.deselectUIInteractable();
|
|
});
|
|
}
|
|
|
|
} |