added enemy dead animation
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user