30 lines
732 B
C#
30 lines
732 B
C#
using System;
|
|
using SoulGames.EasyGridBuilderPro;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater
|
|
{
|
|
public class BuildableEvent : MonoBehaviour
|
|
{
|
|
private async void Start()
|
|
{
|
|
while (!EasyGridBuilderPro.Instance)
|
|
{
|
|
await Awaitable.NextFrameAsync();
|
|
}
|
|
|
|
EasyGridBuilderPro.Instance.OnObjectPlaced += OnParentSet;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
EasyGridBuilderPro.Instance.OnObjectPlaced -= OnParentSet;
|
|
}
|
|
|
|
public void OnParentSet(object o, EventArgs eventArgs)
|
|
{
|
|
var obj = (BuildableGridObject)o;
|
|
obj.GetComponent<SetParent>()?.OnParentSet();
|
|
}
|
|
}
|
|
} |