mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-05 07:41:10 +00:00
feat: add teleport system
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using _Project.Develop.Runtime.Entities;
|
||||
using _Project.Develop.Runtime.Utils.InputManagement;
|
||||
using _Project.Develop.Runtime.Utils.ReactiveManagement.Event;
|
||||
using UnityEngine;
|
||||
|
||||
namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Input
|
||||
{
|
||||
public class TeleportByInputSystem : IInitializableSystem, IDisposableSystem
|
||||
{
|
||||
private readonly IPlayerInput _playerInput;
|
||||
|
||||
private ReactiveEvent _startTeleportRequest;
|
||||
|
||||
public TeleportByInputSystem(IPlayerInput playerInput)
|
||||
{
|
||||
_playerInput = playerInput;
|
||||
}
|
||||
|
||||
public void OnInit(Entity entity)
|
||||
{
|
||||
_startTeleportRequest = entity.StartTeleportRequest;
|
||||
|
||||
_playerInput.Jump.Enter += OnTeleportRequest;
|
||||
}
|
||||
|
||||
private void OnTeleportRequest(float value)
|
||||
{
|
||||
_startTeleportRequest.Invoke();
|
||||
}
|
||||
|
||||
public void OnDispose()
|
||||
{
|
||||
_playerInput.Jump.Enter -= OnTeleportRequest;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 585250d7186e42928f1909e712a63f12
|
||||
timeCreated: 1771759696
|
||||
Reference in New Issue
Block a user