/// <summary> /// Switch the weapons the character is equipped with. /// </summary> /// <param name="current">The current weapon.</param> /// <param name="target">The desired weapon.</param> private IEnumerator Switch(IWeapon current, IWeapon target) { current.Deselect(); yield return(new WaitForSeconds(current.HideAnimationLength)); current.Viewmodel.SetActive(false); Select(target); }
/// <summary> /// Change the weapons the character is equipped with. /// </summary> /// <param name="current">The current weapon.</param> /// <param name="target">The desired weapon.</param> private IEnumerator Change(IWeapon current, IWeapon target) { current.Deselect(); if (!m_FastChangeWeapons) { yield return(new WaitForSeconds(current.HideAnimationLength)); } current.Viewmodel.SetActive(false); Select(target); }
/// <summary> /// Replace the current weapon for the target weapon and drop it. /// </summary> /// <param name="current">The current weapon.</param> /// <param name="target">The desired weapon.</param> /// <param name="drop">The current weapon Prefab.</param> private IEnumerator DropAndChange(IWeapon current, IWeapon target, GunPickup drop) { current.Deselect(); if (!m_FastChangeWeapons) { yield return(new WaitForSeconds(((Gun)current).HideAnimationLength)); } if (((Gun)current).DroppablePrefab) { // ReSharper disable once Unity.InefficientPropertyAccess Instantiate(((Gun)current).DroppablePrefab, drop.transform.position, drop.transform.rotation); } Destroy(drop.transform.gameObject); current.Viewmodel.SetActive(false); Select(target); }
/// <summary> /// Deselect the current weapon to simulate climbing a ladder. /// </summary> private void OnEnterLadder() { m_OnLadder = true; m_ItemCoolDown = true; m_CurrentWeapon.Deselect(); }