|
Post by dfrano92 on May 4, 2023 23:56:16 GMT
Could anyone help me by explaining how does the "Start Cinematic" Trigger work?
If I wanted to start the Cinematic on a specific situation, i.e. when the player collides with a Trigger or an Object, how would I communicate this to the ProCamera2D plugin?
Very much appreciated!!!
|
|
|
Post by onemanonmars on Jul 14, 2023 10:20:53 GMT
I have created a custom script for this case, maybe it is helpful to you as well:
using System.Collections; using UnityEngine; using Com.LuisPedroFonseca.ProCamera2D;
public class StartCinematicOnTriggerEnter : MonoBehaviour {
public ProCamera2DCinematics cinematic01; public bool once; public bool debug; public float delay = 0;
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (delay > 0) { StartCoroutine(WaitAMoment()); } else { cinematic01.Play(); if (debug) { Debug.Log("Player has entered the trigger"); } if (once && GetComponent<Collider2D>() != null) { GetComponent<Collider2D>().enabled = false; } } }
} private IEnumerator WaitAMoment() { yield return new WaitForSeconds(delay); cinematic01.Play(); if (debug) { Debug.Log("Player has entered the trigger"); } if (once && GetComponent<Collider2D>() != null) { GetComponent<Collider2D>().enabled = false; } }
public void StartCinematic() {
if (delay > 0) { StartCoroutine(WaitAMoment()); } else { cinematic01.Play(); if (debug) { Debug.Log("Player has entered the trigger"); }
}
} }
|
|