void OnPicked(PlayerCharacterController byPlayer) { PlayerWeaponsManager playerWeaponsManager = byPlayer.GetComponent <PlayerWeaponsManager>(); if (playerWeaponsManager) { if (playerWeaponsManager.AddWeapon(weaponPrefab)) { // Handle auto-switching to weapon if no weapons currently if (playerWeaponsManager.GetActiveWeapon() == null) { playerWeaponsManager.SwitchWeapon(true); } m_Pickup.PlayPickupFeedback(); } } }
void OnPicked(PlayerCharacterController byPlayer) { Debug.Log($"WeaponPickup OnPicked() weaponName={weaponPrefab.weaponName}"); PlayerWeaponsManager playerWeaponsManager = byPlayer.GetComponent <PlayerWeaponsManager>(); if (playerWeaponsManager) { if (playerWeaponsManager.AddWeapon(weaponPrefab, weaponPrefab.weaponName)) { // Handle auto-switching to weapon if no weapons currently if (playerWeaponsManager.GetActiveWeapon() == null) { playerWeaponsManager.SwitchWeapon(true); } m_Pickup.PlayPickupFeedback(); Destroy(gameObject); } } }
void OnPicked(PlayerCharacterController byPlayer) { PlayerWeaponsManager playerWeaponsManager = byPlayer.GetComponent <PlayerWeaponsManager>(); if (playerWeaponsManager) { if (playerWeaponsManager.AddWeapon(weaponPrefab)) { // Handle auto-switching to weapon if no weapons currently if (playerWeaponsManager.GetActiveWeapon() == null) { playerWeaponsManager.SwitchWeapon(true); } m_Pickup.PlayPickupFeedback(); TelemetryLogger.LogCollect("Weapon", transform.position, weaponPrefab.weaponName, playerWeaponsManager.GetWeaponsHeldCount()); Destroy(gameObject); } } }