Пример #1
0
    void OnPicked(PlayerCharacterController byPlayer)
    {
        Debug.Log("Wassup, piccking sumpin");

        var playerWeaponsManagers = byPlayer.GetComponents <PlayerWeaponsManager>();

        foreach (var mgr in playerWeaponsManagers)
        {
            if (mgr.AddWeapon(weaponPrefab))
            {
                // Handle auto-switching to weapon if no weapons currently
                if (mgr.GetActiveWeapon() == null)
                {
                    mgr.SwitchWeapon(true);
                }

                m_Pickup.PlayPickupFeedback();

                Destroy(gameObject);
            }
        }
    }