Миксер

Почини интерфейс
This commit is contained in:
ThomasCharester committed 2026-03-23 23:59:32 +03:00
1 parent 1aceea1b79
commit 60c28f54f2
74 files changed
+8060 -1059

No files matched your search

@@ -1,9 +1,16 @@
using Code.Infrastructure.Configs;
using Code.Infrastructure.EventBus;
using Reflex.Attributes;
using UnityEngine;
namespace Code.Example.Platformer.Entity
{
public abstract class Entity : MonoBehaviour
public interface IGameplayFreezeable : IGlobalSubscriber
{
void Freeze();
void UnFreeze();
}
public abstract class Entity : MonoBehaviour, IGameplayFreezeable
{
protected static readonly int VelocityY = Animator.StringToHash("VelocityY");
protected static readonly int VelocityX = Animator.StringToHash("VelocityX");
@@ -12,26 +19,47 @@ namespace Code.Example.Platformer.Entity
protected static readonly int OnDeath = Animator.StringToHash("OnDeath");
protected static readonly int Died = Animator.StringToHash("Died");
[SerializeField] protected Rigidbody2D rigidbody2D;
[SerializeField] protected new Rigidbody2D rigidbody2D;
[SerializeField] protected Animator animator;
[SerializeField] protected SpriteRenderer spriteRenderer;
[SerializeField] private Vector2 groundPoint;
private PlatformerEntityData _data; // TODO
protected bool isFreezed;
protected bool isFreezed = true;
protected bool onGround;
private EventBus _eventBus;
private Vector2 _frozenVelocity;
public void SetData(PlatformerEntityData data)
{
_data = data;
}
[Inject]
private void Construct(EventBus eventBus)
{
_eventBus = eventBus;
_eventBus.Subscribe(this);
}
protected virtual void OnDestroy()
{
_eventBus.Unsubscribe(this);
}
public void Freeze()
{
_frozenVelocity = rigidbody2D.linearVelocity;
rigidbody2D.linearVelocity = Vector2.zero;
rigidbody2D.bodyType = RigidbodyType2D.Kinematic;
isFreezed = true;
}
public void UnFreeze()
{
rigidbody2D.linearVelocity = _frozenVelocity;
rigidbody2D.bodyType = RigidbodyType2D.Dynamic;
isFreezed = false;
}