1
This commit is contained in:
@@ -4,7 +4,7 @@ using BITKit;
|
||||
using BITKit.Entities;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using IEntity = BITKit.Core.Entites.IEntity;
|
||||
using IEntity = BITKit.Entities.IEntity;
|
||||
|
||||
namespace BITFALL.Entities.Equipment
|
||||
{
|
||||
@@ -12,18 +12,23 @@ namespace BITFALL.Entities.Equipment
|
||||
{
|
||||
[SerializeField] protected AssetableItem assetableItem;
|
||||
public bool IsEntered { get; set; }
|
||||
|
||||
public virtual void Entry()
|
||||
{
|
||||
|
||||
UnityEntity.AddListener<string>(Constant.Animation.OnEvent, OnAnimationEvent);
|
||||
}
|
||||
|
||||
protected virtual void OnAnimationEvent(string animationEventName)
|
||||
{
|
||||
}
|
||||
public virtual UniTask EntryAsync()
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public virtual void Exit()
|
||||
public virtual void Exit()
|
||||
{
|
||||
UnityEntity.RemoveListener<string>(Constant.Animation.OnEvent, OnAnimationEvent);
|
||||
}
|
||||
|
||||
public virtual UniTask ExitAsync()
|
||||
|
@@ -7,6 +7,7 @@ using BITFALL.Entities.Equipment;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using BITKit.StateMachine;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Guns
|
||||
@@ -16,6 +17,8 @@ namespace BITFALL.Guns
|
||||
[SerializeField] private Transform firePoint;
|
||||
[SerializeReference,SubclassSelector] private IBulletService bulletService;
|
||||
[SerializeField] private bool forceFire;
|
||||
[SerializeField] private Optional<int> customFireRate;
|
||||
[SerializeField] private Optional<IntervalUpdate> customFireInterval;
|
||||
private AssetableGun _gun=>assetableItem as AssetableGun;
|
||||
|
||||
private readonly IntervalUpdate fireInterval = new();
|
||||
@@ -24,6 +27,10 @@ namespace BITFALL.Guns
|
||||
{
|
||||
base.Entry();
|
||||
fireInterval.Interval = _gun.FireMode.FireRate is 0 ? 1 : 1f/_gun.FireMode.FireRate;
|
||||
if (customFireRate.Allow)
|
||||
{
|
||||
fireInterval.Interval =customFireRate.Value is 0 ? 1 : 1f / customFireRate.Value;
|
||||
}
|
||||
UnityEntity.AddListener<BITConstant.Command.AttackCommand>(OnAttack);
|
||||
}
|
||||
public override void Exit()
|
||||
@@ -36,7 +43,17 @@ namespace BITFALL.Guns
|
||||
{
|
||||
if (forceFire && fireInterval.AllowUpdate)
|
||||
{
|
||||
OnAttack(new BITConstant.Command.AttackCommand());
|
||||
if(customFireInterval.Allow)
|
||||
{
|
||||
if (customFireInterval.Value.AllowUpdate)
|
||||
{
|
||||
OnAttack(new BITConstant.Command.AttackCommand());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OnAttack(new BITConstant.Command.AttackCommand());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.OleDb;
|
||||
using BITFALL.Bullet;
|
||||
using BITFALL.Guns;
|
||||
using BITFALL.Items.Melee;
|
||||
using BITKit;
|
||||
using BITKit.Entities.Melee;
|
||||
using UnityEngine;
|
||||
@@ -14,6 +16,7 @@ namespace BITFALL.Entities.Equipment
|
||||
[SerializeField] private bool forceAttack;
|
||||
|
||||
private readonly IntervalUpdate interval = new(1);
|
||||
private AssetableMelee assetableMelee=>assetableItem as AssetableMelee;
|
||||
public override void Entry()
|
||||
{
|
||||
base.Entry();
|
||||
@@ -37,6 +40,25 @@ namespace BITFALL.Entities.Equipment
|
||||
{
|
||||
UnityEntity.Invoke(Constant.Animation.Play, BITConstant.Player.Melee);
|
||||
}
|
||||
|
||||
protected override void OnAnimationEvent(string animationEventName)
|
||||
{
|
||||
switch (animationEventName)
|
||||
{
|
||||
case BITConstant.Player.Attack:
|
||||
case BITConstant.Player.Melee:
|
||||
meleeService.Melee(new MeleeCommand()
|
||||
{
|
||||
Damage = assetableMelee.MeleeDamage,
|
||||
Force = assetableMelee.MeleeForce,
|
||||
PlayerId = Entity.Id,
|
||||
Position = transform.position,
|
||||
Range = assetableMelee.MeleeRange,
|
||||
Forward = UnityEntity.transform.forward,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -292,7 +292,7 @@ namespace BITFALL.Guns.States
|
||||
}
|
||||
public override void OnStateEntry(IState old)
|
||||
{
|
||||
root.animator.Play(BITConstant.Player.Melee);
|
||||
root.UnityEntity.Invoke(Constant.Animation.Play, BITConstant.Player.Melee);
|
||||
_entityMovement.ExecuteCommand(new PlayerDisableRunCommand(this));
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,7 @@ using BITKit;
|
||||
using BITKit.Entities;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using IEntity = BITKit.Core.Entites.IEntity;
|
||||
using IEntity = BITKit.Entities.IEntity;
|
||||
|
||||
namespace BITFALL.Guns
|
||||
{
|
||||
|
13
Assets/Artists/Scripts/Equip/EmptyController.cs
Normal file
13
Assets/Artists/Scripts/Equip/EmptyController.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit.Entities;
|
||||
using BITKit.StateMachine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Player.Equip
|
||||
{
|
||||
public sealed class EmptyController : BITEquipBase<EmptyState>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -9,7 +9,7 @@ using UnityEngine.InputSystem;
|
||||
|
||||
namespace BITFALL.Player.Movement
|
||||
{
|
||||
public class EquipSway : EntityComponent
|
||||
public class EquipSway : EntityBehavior
|
||||
{
|
||||
[SerializeField] private float rotDelta;
|
||||
[SerializeField] private float rotValue;
|
||||
@@ -22,8 +22,8 @@ namespace BITFALL.Player.Movement
|
||||
private IEquipService _equipService;
|
||||
public override void OnAwake()
|
||||
{
|
||||
_movement = entity.Get<IEntityMovement>();
|
||||
_equipService = entity.Get<IEquipService>();
|
||||
_movement = UnityEntity.Get<IEntityMovement>();
|
||||
_equipService = UnityEntity.Get<IEquipService>();
|
||||
}
|
||||
|
||||
public override void OnLateUpdate(float deltaTime)
|
||||
|
@@ -5,7 +5,6 @@ using BITFALL.Items.Melee;
|
||||
using BITFALL.Combat;
|
||||
using BITFALL.Player.Movement;
|
||||
using BITKit;
|
||||
using BITKit.Core.Entites;
|
||||
using BITKit.Entities;
|
||||
using BITKit.Entities.Melee;
|
||||
using BITKit.StateMachine;
|
||||
|
@@ -83,7 +83,7 @@ namespace BITFALL.Entities.Equipment.Melee
|
||||
public override void OnStateEntry(IState old)
|
||||
{
|
||||
base.OnStateEntry(old);
|
||||
meleeController.animator.Play(BITConstant.Player.Attack);
|
||||
meleeController.UnityEntity.Invoke(Constant.Animation.Play,BITConstant.Player.Attack);
|
||||
}
|
||||
public override void OnStateUpdate(float deltaTime)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ namespace BITFALL.Entities.Equipment.Melee
|
||||
public override void OnStateEntry(IState old)
|
||||
{
|
||||
base.OnStateEntry(old);
|
||||
meleeController.animator.Play(BITConstant.Player.Charging);
|
||||
meleeController.UnityEntity.Invoke(Constant.Animation.Play,BITConstant.Player.Charging);
|
||||
|
||||
}
|
||||
public override void OnStateUpdate(float deltaTime)
|
||||
@@ -127,7 +127,7 @@ namespace BITFALL.Entities.Equipment.Melee
|
||||
public override void OnStateEntry(IState old)
|
||||
{
|
||||
base.OnStateEntry(old);
|
||||
meleeController.animator.Play(BITConstant.Player.HeavyAttack);
|
||||
meleeController.UnityEntity.Invoke(Constant.Animation.Play,BITConstant.Player.HeavyAttack);
|
||||
_playerMovement.Stamina -= meleeController.melee.HeavyAttackStaminaCost;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ namespace BITFALL.Entities.Equipment.Melee
|
||||
{
|
||||
base.OnStateEntry(old);
|
||||
_interval.Reset();
|
||||
meleeController.animator.Play(BITConstant.Player.Blocking);
|
||||
meleeController.UnityEntity.Invoke(Constant.Animation.Play,BITConstant.Player.Blocking);
|
||||
}
|
||||
public override void OnStateUpdate(float deltaTime)
|
||||
{
|
||||
|
@@ -7,7 +7,7 @@ using BITKit.Entities;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using RotaryHeart.Lib.SerializableDictionary;
|
||||
using UnityEngine;
|
||||
using IEntity = BITKit.Core.Entites.IEntity;
|
||||
using IEntity = BITKit.Entities.IEntity;
|
||||
|
||||
namespace BITFALL.Player.Equip
|
||||
{
|
||||
|
Reference in New Issue
Block a user