17 lines
514 B
C#
17 lines
514 B
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
namespace RR.Common.Behaviour
|
|
{
|
|
public class FreezePlayerAction : SequenceAction
|
|
{
|
|
[SerializeField] private RigidbodyConstraints2D freezeMode = RigidbodyConstraints2D.FreezeAll;
|
|
|
|
public override IEnumerator Execute(Sequencer context, GameObject target)
|
|
{
|
|
if (!target || !target.CompareTag("Player")) yield break;
|
|
|
|
target.GetComponent<Rigidbody2D>().constraints = freezeMode;
|
|
}
|
|
}
|
|
} |