Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
26 lines
806 B
C#
26 lines
806 B
C#
using System;
|
|
using System.Collections;
|
|
using RR.Game2D.Core.Managers;
|
|
using UnityEngine;
|
|
|
|
namespace RR.Common.Behaviour
|
|
{
|
|
[Serializable]
|
|
public class FreezePlayerAction : SequenceAction
|
|
{
|
|
[SerializeField] private RigidbodyConstraints2D freezeMode = RigidbodyConstraints2D.FreezeAll;
|
|
|
|
public override IEnumerator Execute(Sequencer context, GameObject target)
|
|
{
|
|
GameObject playerObject = target;
|
|
|
|
if (!playerObject || !playerObject.CompareTag("Player")) playerObject = GameManager.Instance.PlayerObj;
|
|
|
|
if (!playerObject || !playerObject.CompareTag("Player")) yield break;
|
|
|
|
playerObject.GetComponent<Rigidbody2D>().constraints = freezeMode;
|
|
|
|
yield return null;
|
|
}
|
|
}
|
|
} |