Events Example Code
using UnityEngine;
using Artifice;
public class TestPlacedEvents : MonoBehaviour
{
public Artificer artificer; // The artificer object we want to listen to
void Start()
{
// Listen to the placedEvent
artificer.placedEvent.AddListener(Built);
// Listent to the builtEvent
artificer.builtEvent.AddListener(AllBuilt);
// Listen to the static PlacedEvent
Artificer.PlacedEvent.AddListener(BuiltStatic);
}
// This method will be called when the Artificer object is fully built
void AllBuilt(Artificer art)
{
Debug.Log("Fully Built");
}
// This methods will called when an emelemnt in the placed list is positioned
void Built(Artificer art, int index)
{
Debug.Log("We built piece " + index);
}
// Same as above but this is from the static event version
void BuiltStatic(Artificer art, int index)
{
Debug.Log("We built piece static " + index);
}
}Last updated