Danro/Assets/Scripts/Behaviour/Sequence/UnfreezePlayerAction.cs

15 lines
431 B
C#

using System.Collections;
using UnityEngine;
namespace RR.Common.Behaviour
{
public class UnfreezePlayerAction : SequenceAction
{
public override IEnumerator Execute(Sequencer context, GameObject target)
{
if (!target || !target.CompareTag("Player")) yield break;
target.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation;
}
}
}