using UnityEngine;
namespace CinemaDirector
{
///
/// Event to set the rigidbody of a given actor into sleep mode.
///
[CutsceneItemAttribute("Physics", "Sleep", CutsceneItemGenre.ActorItem)]
public class RigidbodySleepEvent : CinemaActorEvent
{
///
/// Trigger this event and set the rigidbody of the actor to sleep.
///
/// The actor to put to sleep.
public override void Trigger(GameObject actor)
{
if (actor != null)
{
Rigidbody rb = actor.GetComponent();
if (rb != null)
{
rb.Sleep();
}
}
}
///
/// Trigger this event and wake up the rigidbody component of the given actor.
///
/// The actor to wake up.
public override void Reverse(GameObject actor)
{
if (actor != null)
{
Rigidbody rb = actor.GetComponent();
if (rb != null)
{
rb.WakeUp();
}
}
}
}
}