12-23-2015, 02:30 PM
You posted yesterday, not a couple of days ago...anyways:
The OnCPReachedEvent is called everytime a controller moves over a CP. So you don't choose for which CPs it's called. Instead your event handler decides if you need to do something. And in fact it's working exactly like uGUI events (both rely on UnityEvents)
The CurvyDefaultEventHandler class shows some examples you can right plug into a controller event (especially the debug methods are useful for testing). All methods are present both as a class member or a static member. To use the former, you'll need to drag the CurvyDefaultEventHandler component to the controller GameObject, this will create a class object.
There isn't much special about events in general. You create a method and bind it to an event (by code or in the editor). Then this method will be called (much like Update() is called by Unity etc...).
So to simplify the example from the docs, create the below method in one of your MonoBehaviours, drag it to some GameObject and connect it to the OnCPReached event of the SplineController:
Does that help?
The OnCPReachedEvent is called everytime a controller moves over a CP. So you don't choose for which CPs it's called. Instead your event handler decides if you need to do something. And in fact it's working exactly like uGUI events (both rely on UnityEvents)
The CurvyDefaultEventHandler class shows some examples you can right plug into a controller event (especially the debug methods are useful for testing). All methods are present both as a class member or a static member. To use the former, you'll need to drag the CurvyDefaultEventHandler component to the controller GameObject, this will create a class object.
There isn't much special about events in general. You create a method and bind it to an event (by code or in the editor). Then this method will be called (much like Update() is called by Unity etc...).
So to simplify the example from the docs, create the below method in one of your MonoBehaviours, drag it to some GameObject and connect it to the OnCPReached event of the SplineController:
Code:
public void OnCPReachedHandler (CurvySplineMoveEventArgs e)
{
// what CP have we moved over?
Debug.Log(e.ControlPoint);
}
Does that help?