Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject spawnedWeapon = Instantiate(WeaponToSpawn, WeaponSocketLocation.position, WeaponSocketLocation.rotation, WeaponSocketLocation);

        if (spawnedWeapon)
        {
            EquippedWeapon = spawnedWeapon.GetComponent <WeaponComponent>();
            if (EquippedWeapon)
            {
                EquippedWeapon.Initialize(this, PlayerCrosshair);

                PlayerEvents.Invoke_OnWEaponEquipped(EquippedWeapon);

                GripIKLocation = EquippedWeapon.GripLocation;
                PlayerAnimator.SetInteger(WeaponTypeHash, (int)EquippedWeapon.WeaponInformation.WeaponType);
            }
        }
    }
Пример #2
0
    public void EquipWeapon(WeaponScriptable weaponScriptable)
    {
        if (weaponScriptable == null)
        {
            return;
        }

        GameObject spawnedWeapon = Instantiate(weaponScriptable.ItemPrefab, WeaponSocketLocation.position, WeaponSocketLocation.rotation, WeaponSocketLocation);

        if (spawnedWeapon)
        {
            EquippedWeapon = spawnedWeapon.GetComponent <WeaponComponent>();
            if (EquippedWeapon)
            {
                EquippedWeapon.Initialize(this, weaponScriptable);

                PlayerEvents.Invoke_OnWEaponEquipped(EquippedWeapon);

                GripIKLocation = EquippedWeapon.GripLocation;
                PlayerAnimator.SetInteger(WeaponTypeHash, (int)EquippedWeapon.WeaponInformation.WeaponType);
            }
        }
    }