This commit is contained in:
CortexCore
2023-10-24 23:37:59 +08:00
parent 325f63d6bc
commit 3e39e627bc
388 changed files with 29043 additions and 889 deletions

View File

@@ -7,7 +7,8 @@
"GUID:7efac18f239530141802fb139776f333",
"GUID:d525ad6bd40672747bde77962f1c401e",
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
"GUID:f51ebe6a0ceec4240a699833d6309b23"
"GUID:f51ebe6a0ceec4240a699833d6309b23",
"GUID:bea3628e8b592ae47ade218cb9ec98db"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -1,16 +1,21 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BITKit;
using BITKit.Animations;
using BITKit.Entities;
using BITKit.Physics;
namespace BITFALL.Entites
{
public class EntityProxyCharacter : EntityComponent
{
public UnityAnimator animator;
[SerializeField] private UnityAnimator animator;
[SerializeReference, SubclassSelector] public References _getDamage;
[SerializeField] private Optional<Collider> aliveCollider = new();
[SerializeField] private bool allowAnimatorParameter;
[SerializeField] private Optional<PhysicsBasedAnimation> physicsBasedAnimation = new();
[Inject]
private IHealth _health;
public override void OnStart()
@@ -20,10 +25,27 @@ namespace BITFALL.Entites
_health.OnSetHealthPoint += OnSetHP;
}
private void FixedUpdate()
{
if (physicsBasedAnimation.Allow)
{
physicsBasedAnimation.Value.Blend =
Mathf.MoveTowards(
physicsBasedAnimation.Value.Blend,
_health.IsAlive ? 1 : 0,
Time.fixedTime
);
}
}
public void OnSetAlive(bool alive)
{
if (aliveCollider.Allow)
aliveCollider.Value.enabled = alive;
if (allowAnimatorParameter && animator is not null)
{
animator.animator.SetBool(nameof(IHealth.IsAlive), alive);
}
}
public void OnSetHP(int hp)

View File

@@ -15,7 +15,7 @@ namespace BITFALL
/// </summary>
public interface IPlayerEquipSelector
{
event Func<IBasicItem,bool> OnTryEquip;
event Func<IBasicItem,bool> TryEquipFactory;
event Action<IDictionary<int, IBasicItem>> OnUpdateEquip;
bool TryDeEquip(IBasicItem item);
bool Cancel();

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITKit;
@@ -7,6 +8,12 @@ namespace BITFALL.Entities.Inventory
{
public interface IEntityInventory : IBasicItemContainer
{
bool UseItem(IBasicItem item);
/// <summary>
/// 已使用Item的回调
/// </summary>
event Action<IBasicItem> OnUsedItem;
bool TryUseItem(IBasicItem item);
event Func<IBasicItem,bool> TryUseItemFactory;
void UseItem(IBasicItem item);
}
}