started building logics for enemy
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Darkmatter.Presentation
|
||||
{
|
||||
public class EnemyAnimationController : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2db86e800d68dad4d98796670a91a679
|
||||
@@ -16,27 +16,27 @@ namespace Darkmatter.Presentation
|
||||
public TwoBoneIKConstraint HandOnGunIK; //for gunHand Ik
|
||||
private Coroutine reloadCoroutine;
|
||||
|
||||
public void PlayReloadAnim(IWeapon currentWeapon)
|
||||
public void PlayReloadAnim(IReloadableWeapon reloadableWeapon)
|
||||
{
|
||||
if (reloadCoroutine == null)
|
||||
{
|
||||
reloadCoroutine = StartCoroutine(ReloadRoutine(currentWeapon));
|
||||
reloadCoroutine = StartCoroutine(ReloadRoutine(reloadableWeapon));
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator ReloadRoutine(IWeapon currentWeapon)
|
||||
IEnumerator ReloadRoutine(IReloadableWeapon reloadableWeapon)
|
||||
{
|
||||
reloadableWeapon.isReloading = true;
|
||||
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);
|
||||
yield return BlendLayerWeight(1, 0, 0.2f);
|
||||
HandOnGunIK.weight = 1f;
|
||||
currentWeapon.Reload();
|
||||
reloadableWeapon.Reload();
|
||||
reloadableWeapon.isReloading = false;
|
||||
reloadCoroutine = null;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user