diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Entities/Generated/EntityAPI.cs b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Entities/Generated/EntityAPI.cs index 9c8c833..873eb88 100644 --- a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Entities/Generated/EntityAPI.cs +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Entities/Generated/EntityAPI.cs @@ -116,6 +116,54 @@ namespace _Project.Develop.Runtime.Entities return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.TeleportToPoint() {Value = value}); } + public _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointRequest FindTeleportPointRequestC => GetComponent<_Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointRequest>(); + + public _Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent FindTeleportPointRequest => FindTeleportPointRequestC.Value; + + public bool TryGetFindTeleportPointRequest(out _Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent value) + { + bool result = TryGetComponent(out _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointRequest component); + if(result) + value = component.Value; + else + value = default(_Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent); + return result; + } + + public _Project.Develop.Runtime.Entities.Entity AddFindTeleportPointRequest() + { + return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointRequest() { Value = new _Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent() }); + } + + public _Project.Develop.Runtime.Entities.Entity AddFindTeleportPointRequest(_Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent value) + { + return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointRequest() {Value = value}); + } + + public _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointEvent FindTeleportPointEventC => GetComponent<_Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointEvent>(); + + public _Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent FindTeleportPointEvent => FindTeleportPointEventC.Value; + + public bool TryGetFindTeleportPointEvent(out _Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent value) + { + bool result = TryGetComponent(out _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointEvent component); + if(result) + value = component.Value; + else + value = default(_Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent); + return result; + } + + public _Project.Develop.Runtime.Entities.Entity AddFindTeleportPointEvent() + { + return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointEvent() { Value = new _Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent() }); + } + + public _Project.Develop.Runtime.Entities.Entity AddFindTeleportPointEvent(_Project.Develop.Runtime.Utils.ReactiveManagement.Event.ReactiveEvent value) + { + return AddComponent(new _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.FindTeleportPointEvent() {Value = value}); + } + public _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.CanStartTeleport CanStartTeleportC => GetComponent<_Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.CanStartTeleport>(); public _Project.Develop.Runtime.Utilities.Conditions.ICompositeCondition CanStartTeleport => CanStartTeleportC.Value; diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/EndTeleportSystem.cs b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/EndTeleportSystem.cs new file mode 100644 index 0000000..c594460 --- /dev/null +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/EndTeleportSystem.cs @@ -0,0 +1,38 @@ +using System; +using _Project.Develop.Runtime.Entities; +using _Project.Develop.Runtime.Utils.ReactiveManagement; +using _Project.Develop.Runtime.Utils.ReactiveManagement.Event; + +namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems +{ + public class EndTeleportSystem : IInitializableSystem, IDisposableSystem + { + private ReactiveVariable _inTeleportProcess; + + private ReactiveEvent _findPointEvent; + private ReactiveEvent _endTeleportEvent; + + private IDisposable _findEventDisposable; + + public void OnInit(Entity entity) + { + _findPointEvent = entity.FindTeleportPointEvent; + _endTeleportEvent = entity.EndTeleportEvent; + _inTeleportProcess = entity.InTeleportProcess; + + _findEventDisposable = _findPointEvent.Subscribe(OnFindEvent); + } + + public void OnDispose() + { + _findEventDisposable.Dispose(); + } + + private void OnFindEvent() + { + _inTeleportProcess.Value = false; + + _endTeleportEvent.Invoke(); + } + } +} \ No newline at end of file diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/EndTeleportSystem.cs.meta b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/EndTeleportSystem.cs.meta new file mode 100644 index 0000000..93236a3 --- /dev/null +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/EndTeleportSystem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c5495feb949542bdac01bbac587fab8b +timeCreated: 1771766015 \ No newline at end of file diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/FindRandomPointForTeleportSystem.cs b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/FindRandomPointForTeleportSystem.cs new file mode 100644 index 0000000..96297b6 --- /dev/null +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/FindRandomPointForTeleportSystem.cs @@ -0,0 +1,36 @@ +using System; +using _Project.Develop.Runtime.Entities; +using _Project.Develop.Runtime.Utils.ReactiveManagement.Event; +using UnityEngine; + +namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems +{ + public class FindRandomPointForTeleportSystem : IInitializableSystem, IDisposableSystem + { + private Transform _toPoint; + + private ReactiveEvent _findPointRequest; + private ReactiveEvent _findPointEvent; + + private IDisposable _findPointRequestDisposable; + + public void OnInit(Entity entity) + { + _toPoint = entity.TeleportToPoint; + _findPointEvent = entity.FindTeleportPointEvent; + + _findPointRequestDisposable = _findPointRequest.Subscribe(OnFindPointRequest); + } + + public void OnDispose() + { + _findPointRequestDisposable.Dispose(); + } + + private void OnFindPointRequest() + { + _toPoint.position = Vector3.zero; + _findPointEvent.Invoke(); + } + } +} \ No newline at end of file diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/FindRandomPointForTeleportSystem.cs.meta b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/FindRandomPointForTeleportSystem.cs.meta new file mode 100644 index 0000000..386433a --- /dev/null +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/FindRandomPointForTeleportSystem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 977f0d8298ff47b5baf552f962b6eeb5 +timeCreated: 1771764055 \ No newline at end of file diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/ProcessTeleportSystem.cs b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/InstantTeleportSystem.cs similarity index 59% rename from Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/ProcessTeleportSystem.cs rename to Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/InstantTeleportSystem.cs index 059177a..5235145 100644 --- a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/ProcessTeleportSystem.cs +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/InstantTeleportSystem.cs @@ -5,36 +5,32 @@ using UnityEngine; namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems { - public class ProcessTeleportSystem : IInitializableSystem, IDisposableSystem + public class InstantTeleportSystem : IInitializableSystem, IDisposableSystem { private Transform _target; private Transform _toPoint; - - private ReactiveEvent _startTeleportEvent; + private ReactiveEvent _endTeleportEvent; - - private IDisposable _startTeleportEventDisposable; - + + private IDisposable _endTeleportDisposable; + public void OnInit(Entity entity) { _target = entity.TeleportTarget; _toPoint = entity.TeleportToPoint; - - _startTeleportEvent = entity.StartTeleportEvent; _endTeleportEvent = entity.EndTeleportEvent; - - _startTeleportEventDisposable = _startTeleportEvent.Subscribe(OnStartTeleportProcess); + + _endTeleportDisposable = _endTeleportEvent.Subscribe(OnEndTeleport); } - - private void OnStartTeleportProcess() - { - _target.position = _toPoint.position; - _endTeleportEvent.Invoke(); - } - + public void OnDispose() { - _startTeleportEventDisposable.Dispose(); + _endTeleportDisposable.Dispose(); + } + + private void OnEndTeleport() + { + _target.position = _toPoint.position; } } } \ No newline at end of file diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/InstantTeleportSystem.cs.meta b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/InstantTeleportSystem.cs.meta new file mode 100644 index 0000000..47c96b5 --- /dev/null +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/InstantTeleportSystem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9f0c47335599454aaa6b713d1056aedc +timeCreated: 1771766007 \ No newline at end of file diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportProcessSystem.cs b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportProcessSystem.cs new file mode 100644 index 0000000..b3bd9fa --- /dev/null +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportProcessSystem.cs @@ -0,0 +1,34 @@ +using System; +using _Project.Develop.Runtime.Entities; +using _Project.Develop.Runtime.Utils.ReactiveManagement; +using _Project.Develop.Runtime.Utils.ReactiveManagement.Event; + +namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems +{ + public class TeleportProcessSystem : IInitializableSystem, IDisposableSystem + { + private ReactiveEvent _findPointRequest; + private ReactiveVariable _inTeleportProcess; + + private ReactiveEvent _startTeleportEvent; + + private IDisposable _startTeleportEventDisposable; + + public void OnInit(Entity entity) + { + _findPointRequest = entity.FindTeleportPointRequest; + + _startTeleportEventDisposable = _startTeleportEvent.Subscribe(OnStartTeleportProcess); + } + + private void OnStartTeleportProcess() + { + _findPointRequest.Invoke(); + } + + public void OnDispose() + { + _startTeleportEventDisposable.Dispose(); + } + } +} \ No newline at end of file diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/ProcessTeleportSystem.cs.meta b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportProcessSystem.cs.meta similarity index 100% rename from Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/ProcessTeleportSystem.cs.meta rename to Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportProcessSystem.cs.meta diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/StartTeleportByEnergySystem.cs b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportStartByEnergySystem.cs similarity index 96% rename from Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/StartTeleportByEnergySystem.cs rename to Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportStartByEnergySystem.cs index 3830ccf..cd594e6 100644 --- a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/StartTeleportByEnergySystem.cs +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportStartByEnergySystem.cs @@ -6,7 +6,7 @@ using _Project.Develop.Runtime.Utils.ReactiveManagement.Event; namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems { - public class StartTeleportByEnergySystem: IInitializableSystem, IDisposableSystem + public class TeleportStartByEnergySystem: IInitializableSystem, IDisposableSystem { private ReactiveEvent _useEnergyRequest; private ReactiveEvent _startTeleportRequest; diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/StartTeleportByEnergySystem.cs.meta b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportStartByEnergySystem.cs.meta similarity index 100% rename from Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/StartTeleportByEnergySystem.cs.meta rename to Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/Systems/TeleportStartByEnergySystem.cs.meta diff --git a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/TeleportComponents.cs b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/TeleportComponents.cs index f019913..e221ab8 100644 --- a/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/TeleportComponents.cs +++ b/Assets/_Project/Develop/Runtime/Logic/Gameplay/Features/Teleport/TeleportComponents.cs @@ -9,6 +9,9 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport public class TeleportTarget : IEntityComponent { public Transform Value; } public class TeleportToPoint : IEntityComponent { public Transform Value; } + public class FindTeleportPointRequest : IEntityComponent { public ReactiveEvent Value; } + public class FindTeleportPointEvent : IEntityComponent { public ReactiveEvent Value; } + public class CanStartTeleport : IEntityComponent { public ICompositeCondition Value; } public class InTeleportProcess : IEntityComponent { public ReactiveVariable Value; }