breakpoint

before change animation type
This commit is contained in:
CortexCore
2023-12-27 02:24:00 +08:00
parent 4adcd33811
commit 08cdf4d785
27 changed files with 3050 additions and 775 deletions

View File

@@ -22,6 +22,8 @@ namespace BITFALL.Entites
[Inject] private IEntityOverride _override;
private readonly List<(Transform transform,Vector3 initialPosition, Quaternion initialRotation)> _initialJoint = new();
private bool _updateNextFrame;
public override void OnStart()
{
base.OnStart();
@@ -44,7 +46,16 @@ namespace BITFALL.Entites
}
}
public override void OnUpdate(float deltaTime)
{
base.OnUpdate(deltaTime);
if (_updateNextFrame)
{
EnsurePhysicsAnimation();
_updateNextFrame = false;
}
}
private void EnsurePhysicsAnimation()
{
@@ -56,13 +67,22 @@ namespace BITFALL.Entites
}
else
{
animator.enabled = _health.IsAlive;
if (_override is not null)
{
animator.enabled = _health.IsAlive || _override.IsOvering;
}
else
{
animator.enabled = _health.IsAlive;
}
}
}
private void OnOverride(bool obj)
{
EnsurePhysicsAnimation();
//EnsurePhysicsAnimation();
_updateNextFrame = true;
}
public void OnSetAlive(bool alive)
{
@@ -76,7 +96,8 @@ namespace BITFALL.Entites
x.transform.localPosition = x.initialPosition;
}
}
EnsurePhysicsAnimation();
//EnsurePhysicsAnimation();
_updateNextFrame = true;
}
public void OnSetHP(int hp)