added enemy dead animation

This commit is contained in:
Mausham
2025-12-30 17:51:20 -08:00
parent 0ec69f66c9
commit b59d12631f
16 changed files with 41248 additions and 54 deletions

View File

@@ -26,19 +26,39 @@ namespace Darkmatter.Presentation
IEnumerator ReloadRoutine(IWeapon currentWeapon)
{
animator.SetLayerWeight(1, 1);
yield return BlendLayerWeight(1, 1, 0.2f);
//animator.SetLayerWeight(1,1);
HandOnGunIK.weight = 0f;
animator.SetTrigger(reloadHash);
yield return new WaitForSeconds(3f); //gave the length of the animation very bad practice
animator.SetLayerWeight(1, 0);
// animator.SetLayerWeight(1, 0);
yield return BlendLayerWeight(1, 0, 0.2f);
HandOnGunIK.weight = 1f;
currentWeapon.Reload();
reloadCoroutine = null;
}
IEnumerator BlendLayerWeight(int layerIndex, float targetWeight, float blendTime)
{
float startWeight = animator.GetLayerWeight(layerIndex);
float time = 0f;
while (time < blendTime)
{
time += Time.deltaTime;
float t = time / blendTime;
float weight = Mathf.Lerp(startWeight, targetWeight, t);
animator.SetLayerWeight(layerIndex, weight);
yield return null;
}
animator.SetLayerWeight(layerIndex, targetWeight);
}
public void PlayShootAnim()
{
Debug.Log("player Shoot");