mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-05 07:41:10 +00:00
feat: add shoot and cooldown systems
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using _Project.Develop.Runtime.Entities;
|
||||
using _Project.Develop.Runtime.Utilities.Conditions;
|
||||
using _Project.Develop.Runtime.Utils.ReactiveManagement;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -9,6 +10,7 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Movement
|
||||
private ReactiveVariable<Vector3> _direction;
|
||||
private ReactiveVariable<float> _speed;
|
||||
private Transform _transform;
|
||||
private ICompositeCondition _canRotate;
|
||||
|
||||
private const float DeadZone = 0.1f;
|
||||
|
||||
@@ -17,10 +19,17 @@ namespace _Project.Develop.Runtime.Logic.Gameplay.Features.Movement
|
||||
_direction = entity.RotateDirection;
|
||||
_speed = entity.RotationSpeed;
|
||||
_transform = entity.Transform;
|
||||
_canRotate = entity.CanRotate;
|
||||
|
||||
if (_direction.Value != Vector3.zero)
|
||||
_transform.rotation = Quaternion.LookRotation(_direction.Value.normalized);
|
||||
}
|
||||
|
||||
public void OnUpdate(float deltaTime)
|
||||
{
|
||||
if (_canRotate.Evaluate() == false)
|
||||
return;
|
||||
|
||||
if (_direction.Value.magnitude < DeadZone)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user