Files
2024-11-20 15:21:28 +01:00

35 lines
680 B
C#

// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Physics)]
[Tooltip("Forces a Game Object's Rigid Body to Sleep at least one frame.")]
public class Sleep : ComponentAction<Rigidbody>
{
[RequiredField]
[CheckForComponent(typeof(Rigidbody))]
public FsmOwnerDefault gameObject;
public override void Reset()
{
gameObject = null;
}
public override void OnEnter()
{
DoSleep();
Finish();
}
void DoSleep()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (UpdateCache(go))
{
rigidbody.Sleep();
}
}
}
}