public void SetCurrentWeapon(PlayerWeaponType weaponType) { if (weaponType == PlayerWeaponType.None) { if (m_currentWeapon) { m_currentWeapon.gameObject.SetActive(false); } m_currentWeapon = null; return; } WeaponBase wb = GetWeapon(weaponType); if (wb) { if (m_currentWeapon) { m_currentWeapon.gameObject.SetActive(false); } m_currentWeapon = wb; m_currentWeapon.gameObject.SetActive(true); m_currentWeapon.OnEquip(); } }
public static void SelectWeapon(PlayerWeaponType weaponType) { switch (weaponType) { case PlayerWeaponType.KNIFE: myslf.knifeSelector.SetActive(true); myslf.gunSelector.SetActive(false); break; case PlayerWeaponType.PISTOL: myslf.knifeSelector.SetActive(false); myslf.gunSelector.SetActive(true); break; } }
public WeaponBase GetWeapon(PlayerWeaponType weaponType) { if (weaponType == PlayerWeaponType.None) { Debug.LogError("Searching for WeaponType.None."); return(null); } foreach (WeaponBase wb in m_allweapons) { if (wb.WeaponType == weaponType) { return(wb); } } Debug.LogError("Unknown weapon: " + weaponType.ToString()); return(null); }
void SetWeapon(PlayerWeaponType weaponType) { if (weaponType != currentWeapon) { currentWeapon = weaponType; animator.SetTrigger("WeaponChange"); switch (weaponType) { case PlayerWeaponType.KNIFE: attackTime = 0.4f; animator.SetInteger("WeaponType", 0); break; case PlayerWeaponType.PISTOL: attackTime = 0.1f; animator.SetInteger("WeaponType", 3); break; } } GameManager.SelectWeapon(weaponType); }
public static PlayerWeaponType GetRandomWeaponType(this PlayerWeaponType weapType) { return((PlayerWeaponType)Random.Range(0, (int)PlayerWeaponType.NumOfWeapons)); }
public static bool IsAmmoUsingWeapon(this PlayerWeaponType weapType) { return(weapType == PlayerWeaponType.MachineGun || weapType == PlayerWeaponType.Pistol || weapType == PlayerWeaponType.RocketLauncher); }
public virtual void Init(PlayerWeaponType type) { this.type = type; }
public override void Init(PlayerWeaponType type) { base.Init(type); }