Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using events to slow down or speed up a Spline Controller
#3
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:

Code:
public void OnCPReachedHandler (CurvySplineMoveEventArgs e)
{
    // what CP have we moved over?
     Debug.Log(e.ControlPoint);
}

Does that help?
Reply


Messages In This Thread
RE: Using events to slow down or speed up a Spline Controller - by Jake - 12-23-2015, 02:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Set Volume to the Volume Controller at Runtime pako88 2 10 04-08-2024, 03:26 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: