private void RpcOnReload() { Animator anim = currentGraphics.GetComponent <Animator>(); if (anim != null) { anim.SetTrigger("Reload"); } }
public void Aim() { Animator anim = currentGraphics.GetComponent <Animator>(); if (PlayerShoot.isAiming) { anim.SetBool("Aiming", true); } else { anim.SetBool("Aiming", false); } }
private IEnumerator Reload_Coroutine() { isReloading = true; CmdOnReload(); yield return(new WaitForSeconds(currentWeapon.reloadTime)); currentWeapon.bullets = currentWeapon.maxBullets; Animator anim = currentGraphics.GetComponent <Animator>(); anim.SetBool("Reload", false); isReloading = false; }
// need to complete void PickUpPrimary(GameObject _weapon) { if (weapon != null) { weapon.SetActive(false); } weapon = _weapon.transform.GetChild(0).gameObject; weapon.SetActive(true); if (weapon.tag == "L96") { CrossHair.SetActive(false); } else { CrossHair.SetActive(true); } PrimaryWeapon = weapon.GetComponent <WeaponGraphics>().weaponInfo; CurrentWeapon = PrimaryWeapon; Primary = true; Secondery = false; currentGraphics = weapon.GetComponent <WeaponGraphics>(); _PlayerShoot.currentWeapon = CurrentWeapon; _PlayerShoot.weaponAnimation = currentGraphics.GetComponent <WeaponAnimation>(); _PlayerShoot.CurrentAmmo = currentGraphics.AmmoStored; // updateAnimator.animator = _PlayerShoot.weaponAnimation.GetComponent<Animator>(); ////////////////////////////////////////////////// }
// SwitchToPrimary method void SwitchToPrimary(GameObject _Primary) { // Set Active (false) the current weapon if (weapon != null) { weapon.SetActive(false); } _PlayerShoot.CancelInvoke("Shoot"); weapon = _Primary.transform.GetChild(0).gameObject; weapon.SetActive(true); if (weapon.tag == "L96") { CrossHair.SetActive(false); } else { CrossHair.SetActive(true); } CurrentWeapon = PrimaryWeapon; _PlayerShoot.CurrentAmmo = _PlayerShoot.CurrentAmmoP; Primary = true; Secondery = false; currentGraphics = weapon.GetComponent <WeaponGraphics>(); _PlayerShoot.currentWeapon = CurrentWeapon; _PlayerShoot.weaponAnimation = currentGraphics.GetComponent <WeaponAnimation>(); }
void RpcOnReload() { Animator anim = currentGraphics.GetComponent <Animator>();// Getscomponent of the type animator in currentGraphics if (anim != null) { anim.SetTrigger("Reload");//Enables the trigger that allows the weapon reload animation } }
void RpcOnReload() { currentSounds.PlayCockSound(); Animator anim = currentGraphics.GetComponent <Animator>(); if (anim != null) { anim.SetTrigger("Reload"); } }
void RpcOnAttack() { Animator anim = currentGraphics.GetComponent <Animator>(); if (anim != null) { anim.SetTrigger("Attack"); } else { Debug.Log("Animatorul nu a fost gasit"); } }
// SwitchToSecondary method void SwitchToSecondary(GameObject _Secondary) { if (weapon != null) { weapon.SetActive(false); } _PlayerShoot.CancelInvoke("Shoot"); weapon = _Secondary.transform.GetChild(0).gameObject; weapon.SetActive(true); CrossHair.SetActive(true); CurrentWeapon = SecondaryWeapon; _PlayerShoot.CurrentAmmo = _PlayerShoot.CurrentAmmoS; Secondery = true; Primary = false; currentGraphics = weapon.GetComponent <WeaponGraphics>(); _PlayerShoot.currentWeapon = CurrentWeapon; _PlayerShoot.weaponAnimation = currentGraphics.GetComponent <WeaponAnimation>(); }
void PickUpSecondary(GameObject _weapon) { if (weapon != null) { weapon.SetActive(false); } weapon = _weapon.transform.GetChild(0).gameObject; weapon.SetActive(true); CrossHair.SetActive(true); SecondaryWeapon = weapon.GetComponent <WeaponGraphics>().weaponInfo; CurrentWeapon = SecondaryWeapon; Secondery = true; Primary = false; currentGraphics = weapon.GetComponent <WeaponGraphics>(); _PlayerShoot.currentWeapon = CurrentWeapon; _PlayerShoot.weaponAnimation = currentGraphics.GetComponent <WeaponAnimation>(); _PlayerShoot.CurrentAmmo = currentGraphics.AmmoStored; }