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();
            }
        }
    }
Beispiel #2
0
    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);
            }
        }
    }
Beispiel #3
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);
            }
        }
    }