mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-05 07:41:10 +00:00
update: add teleport systems for entity
This commit is contained in:
@@ -17,7 +17,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Energy
|
||||
public class RegenEnergyEvent : IEntityComponent { public ReactiveEvent<int> Value; }
|
||||
|
||||
public class AutoRegenEnergyAmount : IEntityComponent { public ReactiveVariable<int> Value; }
|
||||
public class InAutoRegenEnergy : IEntityComponent { public ReactiveVariable<bool> Value; }
|
||||
public class IsAutoRegenEnergy : IEntityComponent { public ReactiveVariable<bool> Value; }
|
||||
public class EnergyAutoRegenInitialTime : IEntityComponent { public ReactiveVariable<float> Value; }
|
||||
public class EnergyAutoRegenCurrentTime : IEntityComponent { public ReactiveVariable<float> Value; }
|
||||
}
|
||||
@@ -13,11 +13,11 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Energy.Systems
|
||||
|
||||
private ReactiveVariable<int> _regenAmount;
|
||||
|
||||
private ReactiveVariable<bool> _inAutoRegen;
|
||||
private ReactiveVariable<bool> _isAutoRegen;
|
||||
|
||||
public void OnInit(Entity entity)
|
||||
{
|
||||
_inAutoRegen = entity.InAutoRegenEnergy;
|
||||
_isAutoRegen = entity.IsAutoRegenEnergy;
|
||||
_regenAmount = entity.AutoRegenEnergyAmount;
|
||||
|
||||
_initialTime = entity.EnergyAutoRegenInitialTime;
|
||||
@@ -26,7 +26,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Energy.Systems
|
||||
|
||||
public void OnUpdate(float deltaTime)
|
||||
{
|
||||
if (_inAutoRegen.Value == false)
|
||||
if (_isAutoRegen.Value == false)
|
||||
return;
|
||||
|
||||
_currentTime.Value += deltaTime;
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems
|
||||
public void OnInit(Entity entity)
|
||||
{
|
||||
_toPoint = entity.TeleportToPoint;
|
||||
_findPointRequest = entity.FindTeleportPointRequest;
|
||||
_findPointEvent = entity.FindTeleportPointEvent;
|
||||
|
||||
_findPointRequestDisposable = _findPointRequest.Subscribe(OnFindPointRequest);
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems
|
||||
|
||||
public void OnInit(Entity entity)
|
||||
{
|
||||
_startTeleportEvent = entity.StartTeleportEvent;
|
||||
_findPointRequest = entity.FindTeleportPointRequest;
|
||||
|
||||
_startTeleportEventDisposable = _startTeleportEvent.Subscribe(OnStartTeleportProcess);
|
||||
|
||||
@@ -3,6 +3,7 @@ using _Project.Develop.Runtime.Entities;
|
||||
using _Project.Develop.Runtime.Utilities.Conditions;
|
||||
using _Project.Develop.Runtime.Utils.ReactiveManagement;
|
||||
using _Project.Develop.Runtime.Utils.ReactiveManagement.Event;
|
||||
using UnityEngine;
|
||||
|
||||
namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems
|
||||
{
|
||||
@@ -29,7 +30,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems
|
||||
_inTeleportProcess = entity.InTeleportProcess;
|
||||
|
||||
_canStartTeleport = entity.CanStartTeleport;
|
||||
|
||||
|
||||
_teleportRequestDispose = _startTeleportRequest.Subscribe(OnTeleportRequest);
|
||||
}
|
||||
|
||||
@@ -37,6 +38,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Teleport.Systems
|
||||
{
|
||||
if (_canStartTeleport.Evaluate())
|
||||
{
|
||||
Debug.Log("OnTeleportRequest");
|
||||
_inTeleportProcess.Value = true;
|
||||
_useEnergyRequest.Invoke(_teleportCost.Value);
|
||||
_startTeleportEvent.Invoke();
|
||||
|
||||
Reference in New Issue
Block a user