Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
32 lines
872 B
C#
32 lines
872 B
C#
using System;
|
|
using System.Collections;
|
|
using RR.Game2D.Core.Managers;
|
|
using UnityEngine;
|
|
|
|
namespace RR.Common.Behaviour
|
|
{
|
|
[Serializable]
|
|
public class TeleportPlayerAction : SequenceAction
|
|
{
|
|
[SerializeField] private bool useRelativePosition = false;
|
|
[SerializeField] private Vector3 position;
|
|
|
|
public override IEnumerator Execute(Sequencer context, GameObject target)
|
|
{
|
|
GameObject playerObj = target;
|
|
|
|
if (!playerObj || !playerObj.CompareTag("Player")) playerObj = GameManager.Instance.PlayerObj;
|
|
|
|
if (useRelativePosition)
|
|
{
|
|
playerObj.transform.position += position;
|
|
}
|
|
else
|
|
{
|
|
playerObj.transform.position = position;
|
|
}
|
|
|
|
yield return null;
|
|
}
|
|
}
|
|
} |