Ejemplo n.º 1
0
    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);
            }
        }
    }