Triggers - AnduoGames/ThirdCrisisModding GitHub Wiki

Triggers are areas that run code when Jenna walks inside them.

Here's example code to create a trigger:

var triggerGameObject = new GameObject();
// Set the position of the Trigger
triggerGameObject.transform.position = new Vector3(4f, 0f, 0f);

var triggerBox = triggerGameObject.AddComponent<BoxCollider>();
// Make the Boxcollider non-blocking, so Jenna can walk through it
triggerBox.isTrigger = true;
// Set the box to the size of 2 by 2 meters
triggerBox.size = new Vector3(2f, 2f);

var trigger = triggerGameObject.AddComponent<Trigger>();
// Ignore NPC's
trigger.OnlyTriggerPlayer = true;
// Trigger even if Jenna is not fully inside
trigger.MustBeEntirelyInside = false;
trigger.OnEnter.AddListener(x =>
{
    Debug.Log("Jenna has stepped inside");
});
⚠️ **GitHub.com Fallback** ⚠️