public void PlayWeaponFireSound(EnumDefinitions.WeaponType weapon) { switch (weapon) { case EnumDefinitions.WeaponType.Pistol: audioSrc.PlayOneShot(pistolSound); break; case EnumDefinitions.WeaponType.Sniper: audioSrc.PlayOneShot(sniperSound); break; case EnumDefinitions.WeaponType.Shotgun: audioSrc.PlayOneShot(shotgunSound); break; case EnumDefinitions.WeaponType.Chaingun: audioSrc.PlayOneShot(chainSound); break; } }
public void SwitchWeapons(EnumDefinitions.WeaponType nextWeapon) { if (nextWeapon != EnumDefinitions.WeaponType.None) { Destroy(currentWeapon); GameObject weaponPrefab = Resources.Load(string.Format("Prefabs/Weapons/{0} Weapon", nextWeapon.ToString())) as GameObject; currentWeapon = Instantiate(weaponPrefab, weaponSpawn.position, weaponSpawn.rotation); currentWeapon.transform.parent = weaponSpawn; currentWeapon.GetComponent <Weapon>().PassEntityAnimator(entityAnimator); // currentWeapon.GetComponent<CopyLocation>().CopyLocationOf(playerHands); // currentWeapon.GetComponent<CopyLocation>().ToggleAxis(2); // Pull the targets from the weapon here // provide the ik hands the target here LeftHand.ProvideNewTarget(currentWeapon.GetComponent <Weapon>().leftIKTarget); RightHand.ProvideNewTarget(currentWeapon.GetComponent <Weapon>().rightIKTarget); uiController.ChangeWeaponInfo(currentWeapon.GetComponent <Weapon>().weaponIcon, currentWeapon.GetComponent <Weapon>().maxProjectileCount); } }