There are a number of Unity events that can be used to trigger behavior in other scripts and game objects. These events are invoked in specific situations, e.g. launch and target intercept.
Some behavior that can be triggered in with events is particle systems or sounds indicating for example target hit. The vents can also be used to create advanced behavior in the MissileSupervisor, see Advanced use. For example, creating a script that uses waypoint change to trigger speed change.
Note that not all events are applicable at all time and for all settings. For example, the event for waypoint change is only available during path following.
Events can be listened to by accessing them in the Unity Editor. They can also be listened to by using AddListener in scripts. The event name used is in parenthesis below. The events are all accessed from an instance of the MissileSupervisor class.
Event (script name) | Description | Argument |
---|---|---|
Intercept Event (m_interceptEvent) | Invoked when this object passes the target within intercept range. Can only happen once in the life cycle. | Game Object. The controlled object, NOT the target. |
Passed Target event (m_passedTarget) | Invoked when this object passes the target. Can happen repeatedly and at very long range from the target. | Game Object. The controlled object, NOT the target. |
Launched event (m_launchEvent) | Invoked at launch, after tracking sequence. Can only happens once. | – |
Guidance stop event (m_guidanceStopEvent) | Invoked when the the missile has permanently stopped guidance. Can happen when instructed to do so at intercept and when flight time limit is reached. Can only happen once. | – |
Next waypoint (m_eventNextWayPoint) | Invoked when waypoint is changed. Only valid for path following. | Int32. The new waypoint, i.e. the first waypoint on the new leg. |
Next motor stage (m_nextMotorStageEvent) | Invoked when a motor stage is started. | Int32. The new motor stage index. |