1
This commit is contained in:
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace BITKit.Entities.Animation
|
||||
{
|
||||
public sealed class EntitiesAnimationController : EntityComponent
|
||||
public sealed class EntitiesAnimationController : EntityBehavior
|
||||
{
|
||||
[SerializeField] private UnityAnimator unityAnimator;
|
||||
[SerializeField] private SerializedDictionary<string, RuntimeAnimatorController> animatorControllers;
|
||||
@@ -20,7 +20,7 @@ namespace BITKit.Entities.Animation
|
||||
public override void OnAwake()
|
||||
{
|
||||
base.OnAwake();
|
||||
_entityEquipment.OnEquip += OnEquip;
|
||||
_entityEquipment.OnEquipAddressable += OnEquip;
|
||||
_initialRuntimeAnimatorController = unityAnimator.animator.runtimeAnimatorController;
|
||||
}
|
||||
|
||||
@@ -32,16 +32,11 @@ namespace BITKit.Entities.Animation
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEquip(IBasicItem obj)
|
||||
private void OnEquip(string equipName)
|
||||
{
|
||||
if(animatorControllers.TryGetValue(obj.AddressablePath, out var controller))
|
||||
{
|
||||
_runtimeAnimatorControllerBuffer.Release(controller);
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeAnimatorControllerBuffer.Release(_initialRuntimeAnimatorController);
|
||||
}
|
||||
_runtimeAnimatorControllerBuffer.Release(animatorControllers.TryGetValue(equipName, out var controller)
|
||||
? controller
|
||||
: _initialRuntimeAnimatorController);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@ using UnityEngine;
|
||||
namespace BITFALL.Entities.Armor
|
||||
{
|
||||
[CustomType(typeof(IArmor))]
|
||||
public class EntityArmor : EntityComponent,IArmor
|
||||
public class EntityArmor : EntityBehavior,IArmor
|
||||
{
|
||||
private int _armor;
|
||||
public int Armor
|
||||
|
@@ -9,7 +9,7 @@ using BITKit.Physics;
|
||||
|
||||
namespace BITFALL.Entites
|
||||
{
|
||||
public class EntityProxyCharacter : EntityComponent
|
||||
public class EntityProxyCharacter : EntityBehavior
|
||||
{
|
||||
[SerializeField] private UnityAnimator animator;
|
||||
[SerializeReference, SubclassSelector] public References _getDamage;
|
||||
|
@@ -23,7 +23,7 @@ using Debug = UnityEngine.Debug;
|
||||
namespace BITFALL.Entities.Equipment
|
||||
{
|
||||
[CustomType(typeof(IPlayerEquipSelector))]
|
||||
public class PlayerEquipSelector : EntityComponent,IPlayerEquipSelector
|
||||
public class PlayerEquipSelector : EntityBehavior,IPlayerEquipSelector
|
||||
{
|
||||
[Header(Constant.Header.InternalVariables)]
|
||||
private readonly Dictionary<int, IBasicItem> equips=new();
|
||||
|
@@ -33,7 +33,7 @@ namespace BITKit.Entities
|
||||
[Header(Constant.Header.Services)]
|
||||
[SerializeReference,SubclassSelector] protected IMeleeService meleeService;
|
||||
|
||||
public Core.Entites.IEntity Entity { get; set; }
|
||||
public Entities.IEntity Entity { get; set; }
|
||||
public Entity UnityEntity=>Entity as Entity;
|
||||
public IBasicItem Item { get; set; }
|
||||
|
||||
@@ -57,8 +57,11 @@ namespace BITKit.Entities
|
||||
if (vfxPlayer)
|
||||
vfxPlayer.enabled = true;
|
||||
|
||||
var animName = animator.animator.GetCurrentAnimatorStateInfo(0).shortNameHash;
|
||||
animator.animator.Play(animName, -1, 0);
|
||||
if (animator)
|
||||
{
|
||||
var animName = animator.animator.GetCurrentAnimatorStateInfo(0).shortNameHash;
|
||||
animator.animator.Play(animName, -1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual UniTask EntryAsync()
|
||||
@@ -126,7 +129,8 @@ namespace BITKit.Entities
|
||||
Position = Transform.position,
|
||||
Force = meleeForce * equip.MeleeForce,
|
||||
Range = equip.MeleeRange,
|
||||
Damage = equip.MeleeDamage
|
||||
Damage = equip.MeleeDamage,
|
||||
Forward = UnityEntity.transform.forward
|
||||
});
|
||||
break;
|
||||
case "HeavyAttack":
|
||||
@@ -137,6 +141,7 @@ namespace BITKit.Entities
|
||||
Force = meleeForce * equip.HeavyMeleeForce,
|
||||
Range = equip.HeavyMeleeRange,
|
||||
Damage = equip.HeavyMeleeDamage,
|
||||
Forward = UnityEntity.transform.forward
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -144,7 +149,7 @@ namespace BITKit.Entities
|
||||
}
|
||||
[CustomType(typeof(IEquipService))]
|
||||
[CustomType(typeof(IEntityEquipment))]
|
||||
public class EntityEquipment : EntityComponent,IEquipService,IEntityEquipment
|
||||
public class EntityEquipment : EntityBehavior,IEquipService,IEntityEquipment
|
||||
{
|
||||
public IOptional<float> Zoom { get; } = new Optional<float>(){Value = 1};
|
||||
|
||||
@@ -185,7 +190,7 @@ namespace BITKit.Entities
|
||||
|
||||
foreach (var x in equips.list)
|
||||
{
|
||||
x.Entity = entity;
|
||||
x.Entity = UnityEntity;
|
||||
x.OnAwake();
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ namespace BITFALL
|
||||
/// 支持,护甲,头盔和背包等
|
||||
/// </summary>
|
||||
[CustomType(typeof(IEntityEquipmentContainer))]
|
||||
public class EntityEquipmentContainer : EntityComponent, IEntityEquipmentContainer
|
||||
public class EntityEquipmentContainer : EntityBehavior, IEntityEquipmentContainer
|
||||
{
|
||||
public IDictionary<IEquipmentSlot, IBasicItem> Equipment { get; } =
|
||||
new Dictionary<IEquipmentSlot, IBasicItem>();
|
||||
@@ -28,7 +28,7 @@ namespace BITFALL
|
||||
|
||||
public override void OnAwake()
|
||||
{
|
||||
var health = entity.Get<IHealth>();
|
||||
var health = UnityEntity.Get<IHealth>();
|
||||
health.OnSetAlive += OnSetAlive;
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,7 @@ using BITKit;
|
||||
using BITKit.Entities;
|
||||
namespace BITFALL.Entites
|
||||
{
|
||||
public class EntityFootstep : EntityComponent
|
||||
public class EntityFootstep : EntityBehavior
|
||||
{
|
||||
void FootStep()
|
||||
{
|
||||
|
@@ -12,7 +12,7 @@ using UnityEngine.InputSystem.Interactions;
|
||||
namespace BITFALL.Entities.Improvised
|
||||
{
|
||||
[CustomType(typeof(ImprovisedServiceInterface))]
|
||||
public class ImprovisedService : EntityComponent,ImprovisedServiceInterface
|
||||
public class ImprovisedService : EntityBehavior,ImprovisedServiceInterface
|
||||
{
|
||||
[Inject] private IHealth _health;
|
||||
[Inject(true)] private IKnockdown _knockdown;
|
||||
|
@@ -16,7 +16,7 @@ namespace BITFALL
|
||||
{
|
||||
[CustomType(typeof(IEntityInventory))]
|
||||
[CustomType(typeof(IBasicItemContainer))]
|
||||
public class EntityInventory : EntityComponent, IEntityInventory
|
||||
public class EntityInventory : EntityBehavior, IEntityInventory
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据字典
|
||||
@@ -25,7 +25,7 @@ namespace BITFALL
|
||||
/// <summary>
|
||||
/// 隐式接口实现
|
||||
/// </summary>
|
||||
public int Id => (int)entity.Id;
|
||||
public int Id => (int)UnityEntity.Id;
|
||||
|
||||
public bool DropOrSpawn(IBasicItem item)
|
||||
{
|
||||
|
@@ -12,7 +12,7 @@ namespace BITFALL
|
||||
event Action<double,double> OnWeighted;
|
||||
}
|
||||
[CustomType(typeof(IPlayerInventoryWeightable))]
|
||||
public class InventoryWeightable : EntityComponent,IPlayerInventoryWeightable
|
||||
public class InventoryWeightable : EntityBehavior,IPlayerInventoryWeightable
|
||||
{
|
||||
[Header(Constant.Header.Data)]
|
||||
public double currentWeight;
|
||||
|
@@ -12,7 +12,7 @@ using UnityEngine;
|
||||
namespace BITFALL.Player.Inventory
|
||||
{
|
||||
[CustomType(typeof(IEntitySwapItem))]
|
||||
public class PlayerInventorySwap : EntityComponent,IEntitySwapItem
|
||||
public class PlayerInventorySwap : EntityBehavior,IEntitySwapItem
|
||||
{
|
||||
public bool TryGetCurrentContainer(out IBasicItemContainer container)
|
||||
{
|
||||
|
@@ -11,7 +11,7 @@ using UnityEngine;
|
||||
namespace BITFALL.Entities
|
||||
{
|
||||
[CustomType(typeof(IKnockdown))]
|
||||
public sealed class EntityKnockdown :EntityComponent,IKnockdown
|
||||
public sealed class EntityKnockdown :EntityBehavior,IKnockdown
|
||||
{
|
||||
[SerializeField] private int knockedHealth;
|
||||
[SerializeField] private int initialKnockedHealth;
|
||||
|
@@ -9,7 +9,7 @@ using UnityEngine;
|
||||
namespace BITKit.Entities
|
||||
{
|
||||
[CustomType(typeof(IMeleeCombat))]
|
||||
public class EntityMelee : EntityComponent,IMeleeCombat
|
||||
public class EntityMelee : EntityBehavior,IMeleeCombat
|
||||
{
|
||||
[SerializeField] private UnityAnimator unityAnimator;
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace BITKit.Entities
|
||||
[Inject(true)] private IEntityOverride entityOverride;
|
||||
public override void OnStart()
|
||||
{
|
||||
entity.AddListener<int>("Melee", Melee);
|
||||
entity.AddListener<string>(AIAction);
|
||||
UnityEntity.AddListener<int>("Melee", Melee);
|
||||
UnityEntity.AddListener<string>(AIAction);
|
||||
|
||||
unityAnimator[0].onStateEnter += OnStateEnter;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ using BITFALL.Entities.Equipment;
|
||||
|
||||
namespace BITFALL
|
||||
{
|
||||
public class EntityPropsDisplay : EntityComponent
|
||||
public class EntityPropsDisplay : EntityBehavior
|
||||
{
|
||||
[SerializeField] private SerializedDictionary<string, GameObject> equipped = new();
|
||||
[SerializeField] private SerializedDictionary<string, GameObject> bodyEquips = new();
|
||||
|
Reference in New Issue
Block a user