1
This commit is contained in:
@@ -6,12 +6,21 @@ using UnityEngine.InputSystem;
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public class NavAgentMovement: StateBasedComponent<IEntityMovementState>,IEntityMovement,IHealthCallback
|
||||
public class NavAgentMovement: StateBasedComponent<IEntityMovementState>,IEntityMovement
|
||||
{
|
||||
#region 属性
|
||||
[SerializeField] private NavMeshAgent agent;
|
||||
[SerializeField] private new Rigidbody rigidbody;
|
||||
|
||||
[Inject] private IHealth _health;
|
||||
#endregion
|
||||
|
||||
public override void OnStart()
|
||||
{
|
||||
_health.OnSetAlive += OnSetAlive;
|
||||
_health.OnSetHealthPoint += OnSetHP;
|
||||
}
|
||||
|
||||
#region 接口实现
|
||||
|
||||
public Vector3 ViewCenter { get; set; }
|
||||
@@ -34,6 +43,9 @@ namespace BITKit
|
||||
GroundVelocity = _groundVelocity;
|
||||
IsGrounded = agent.isOnOffMeshLink is false;
|
||||
|
||||
entity.Set<bool>("IsMoving",Velocity.sqrMagnitude>=0.16f);
|
||||
entity.Set<float>("SqrMagnitude",Velocity.sqrMagnitude);
|
||||
|
||||
if (!isDead) return;
|
||||
|
||||
recordPosition = rigidbody.position;
|
||||
|
Reference in New Issue
Block a user