1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BITFALL.Player.Movement;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using BITKit.StateMachine;
|
||||
using Lightbug.CharacterControllerPro.Core;
|
||||
@@ -8,13 +9,13 @@ namespace BITFALL.Entities.Player.Movement.States
|
||||
{
|
||||
public abstract class PlayerCharacterState : IEntityMovementState
|
||||
{
|
||||
[SerializeField] protected PlayerCharacterController characterController;
|
||||
[Inject] public PlayerCharacterController self;
|
||||
[SerializeField] protected CharacterActor actor;
|
||||
private IEntityMovementState entryState;
|
||||
public bool Enabled { get; set; }
|
||||
public virtual void Initialize()
|
||||
{
|
||||
characterController.UnityEntity.Inject(this);
|
||||
|
||||
}
|
||||
|
||||
public virtual void OnStateEntry(IState old)
|
||||
@@ -53,24 +54,24 @@ namespace BITFALL.Entities.Player.Movement.States
|
||||
{
|
||||
if ( entryState is not null)
|
||||
{
|
||||
if ( entryState is IPlayerWalkState or IPlayerRunState or IPlayerSprintState && characterController.topBlocked )
|
||||
if ( entryState is IPlayerWalkState or IPlayerRunState or IPlayerSprintState && self.topBlocked )
|
||||
{
|
||||
characterController.TransitionState<Crouch>();
|
||||
self.TransitionState<Crouch>();
|
||||
}
|
||||
else
|
||||
{
|
||||
characterController.TransitionState(entryState);
|
||||
self.TransitionState(entryState);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (characterController.topBlocked)
|
||||
if (self.topBlocked)
|
||||
{
|
||||
characterController.TransitionState<Crouch>();
|
||||
self.TransitionState<Crouch>();
|
||||
}
|
||||
else
|
||||
{
|
||||
characterController.TransitionState<Walk>();
|
||||
self.TransitionState<Walk>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user