52 lines
1.1 KiB
C#
52 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITFALL.Entities;
|
|
using BITFALL.Player.Equip;
|
|
using BITFALL.Player.Movement;
|
|
using BITKit;
|
|
using BITKit.Animations;
|
|
using BITKit.Entities;
|
|
using UnityEngine;
|
|
|
|
namespace BITFALL.Feel
|
|
{
|
|
public sealed class PlayerHandAnimations : EntityBehavior
|
|
{
|
|
[SerializeField] private UnityAnimator animator;
|
|
|
|
[Inject]
|
|
private IPlayerMovement _playerMovement;
|
|
[Inject]
|
|
private IKnockdown _knockdown;
|
|
[Inject]
|
|
private IEquipService _equipService;
|
|
public override void OnStart()
|
|
{
|
|
_playerMovement.OnParachuteOpened += OnParachuteOpened;
|
|
_playerMovement.OnParachuteClosed += OnParachuteClosed;
|
|
|
|
_knockdown.OnKnockdown += OnKnockdown;
|
|
}
|
|
|
|
public override void OnUpdate(float deltaTime)
|
|
{
|
|
base.OnUpdate(deltaTime);
|
|
_equipService.AllowEquip.SetDisableElements(this,animator[0].stateName != BITConstant.Player.Idle);
|
|
}
|
|
|
|
private void OnKnockdown()
|
|
{
|
|
animator.Play("OnKnockdown");
|
|
}
|
|
private void OnParachuteClosed()
|
|
{
|
|
animator.Play("OnParachuteClosed");
|
|
}
|
|
private void OnParachuteOpened()
|
|
{
|
|
animator.Play("OnParachute");
|
|
}
|
|
}
|
|
|
|
}
|