added TeleportPlayerAction class, updated UnfreezePlayerAction and SequenceActionDrawer to include teleport functionality
This commit is contained in:
parent
c3290d80dd
commit
384a8fad82
File diff suppressed because one or more lines are too long
255840
Assets/Scenes/99-99.unity
255840
Assets/Scenes/99-99.unity
File diff suppressed because it is too large
Load Diff
30
Assets/Scripts/Behaviour/Sequence/TeleportPlayerAction.cs
Normal file
30
Assets/Scripts/Behaviour/Sequence/TeleportPlayerAction.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using RR.Game2D.Core.Managers;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RR.Common.Behaviour
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9eb68ed1fbf484583461c4a858f6bd2
|
||||
timeCreated: 1766491262
|
||||
@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RR.Common.Behaviour
|
||||
{
|
||||
[Serializable]
|
||||
public class UnfreezePlayerAction : SequenceAction
|
||||
{
|
||||
public override IEnumerator Execute(Sequencer context, GameObject target)
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RR.Common.InspectorOverrides
|
||||
{ "Удалить объект", typeof(DeleteGameObjectAction) },
|
||||
{ "Поведение игрока/Заморозить игрока", typeof(FreezePlayerAction) },
|
||||
{ "Поведение игрока/Разморозить игрока", typeof(UnfreezePlayerAction) },
|
||||
{ "Поведение игрока/Телепортировать игрока", typeof(TeleportPlayerAction) },
|
||||
{ "Поведение диалога/Добавить сообщение", typeof(AddMessageAction) },
|
||||
{ "Поведение сообщения/Появление сообщения", typeof(MessageAppearAction) },
|
||||
{ "Поведение сообщения/Исчезновение сообщения", typeof(MessageDisappearAction) },
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad0add7ebdc975d40aabb0cb7e06770e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
358426
Assets/_Recovery/0.unity
358426
Assets/_Recovery/0.unity
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb456ced8ebe5c14682d1e8345303da6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user