Ejemplo n.º 1
0
        public void EquipWeapon(WeaponScriptable weaponScriptable)
        {
            if (weaponScriptable == null)
            {
                return;
            }

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

            if (!spawnedWeapon)
            {
                return;
            }

            WeaponComponent = spawnedWeapon.GetComponent <WeaponComponent>();
            if (!WeaponComponent)
            {
                return;
            }

            WeaponComponent.Initialize(this, weaponScriptable);

            PlayerEvents.Invoke_OnWeaponEquipped(WeaponComponent);

            GripIKLocation = WeaponComponent.GripLocation;
            PlayerAnimator.SetInteger(WeaponTypeHash, (int)WeaponComponent.WeaponInformation.WeaponType);
        }
Ejemplo n.º 2
0
        // Start is called before the first frame update
        private void Start()
        {
            GameObject spawnedWeapon = Instantiate(Weapon, WeaponSocket.position, WeaponSocket.rotation);

            if (!spawnedWeapon)
            {
                return;
            }

            spawnedWeapon.transform.parent = WeaponSocket;
            EquippedWeapon = spawnedWeapon.GetComponent <WeaponComponent>();
            GripLocation   = EquippedWeapon.HandPosition;

            EquippedWeapon.Initialize(this, PlayerController.CrosshairComponent);

            PlayerEvents.Invoke_OnWeaponEquipped(EquippedWeapon);
        }
Ejemplo n.º 3
0
        public void EquipWeapon(WeaponScriptable weaponScriptable)
        {
            GameObject spawnedWeapon = Instantiate(weaponScriptable.ItemPrefab, WeaponSocket.position, WeaponSocket.rotation);

            if (!spawnedWeapon)
            {
                return;
            }

            spawnedWeapon.transform.parent = WeaponSocket;
            WeaponComponent = spawnedWeapon.GetComponent <WeaponComponent>();

            GripLocation = EquippedWeapon.HandPosition;

            EquippedWeapon.Initialize(this, weaponScriptable);
            PlayerAnimator.SetInteger(WeaponTypeHash, (int)EquippedWeapon.WeaponStats.WeaponType);

            PlayerEvents.Invoke_OnWeaponEquipped(EquippedWeapon);
        }
Ejemplo n.º 4
0
    public void EquipWeapon(WeaponScriptable weaponScripable)
    {
        GameObject spawnedWeapon = Instantiate(weaponScripable.ItemPrefab, WeaponSocketLocation.position, WeaponSocketLocation.rotation, WeaponSocketLocation);

        if (!spawnedWeapon)
        {
            return;
        }
        if (spawnedWeapon)
        {
            WeaponComponent = spawnedWeapon.GetComponent <WeaponComponent>();
            if (WeaponComponent)
            {
                GripIKLocation = WeaponComponent.GripLocation;
            }
        }

        WeaponComponent.Initialize(this, weaponScripable);
        PlayerAnimator.SetInteger("WeaponType", (int)WeaponComponent.WeaponStats.WeaponType);
        PlayerEvents.Invoke_OnWeaponEquipped(WeaponComponent);
    }
Ejemplo n.º 5
0
        // Start is called before the first frame update
        void Start()
        {
            GameObject spawnedWeapon = Instantiate(WeaponToSpawn, WeaponSocketLocation.position, WeaponSocketLocation.rotation, WeaponSocketLocation);

            if (!spawnedWeapon)
            {
                return;
            }

            EquippedWeapon = spawnedWeapon.GetComponent <WeaponComponent>();
            if (!EquippedWeapon)
            {
                return;
            }

            EquippedWeapon.Initialize(this, PlayerCrosshair);

            PlayerEvents.Invoke_OnWeaponEquipped(EquippedWeapon);

            GripIKLocation = EquippedWeapon.GripLocation;
            PlayerAnimator.SetInteger(WeaponTypeHash, (int)EquippedWeapon.WeaponInformation.WeaponType);
        }
        // Start is called before the first frame update
        private void Start()
        {
            GameObject spawnedWeapon = Instantiate(Weapon, WeaponSocket.position, WeaponSocket.rotation);

            if (!spawnedWeapon)
            {
                return;
            }

            if (spawnedWeapon)
            {
                WeaponComponent weapon = spawnedWeapon.GetComponent <WeaponComponent>();
                if (weapon)
                {
                    PlayerAnimator.SetInteger("WeaponType", (int)weapon.WeaponStats.WaeaponType);
                    spawnedWeapon.transform.parent = WeaponSocket;
                    EquippedWeapon = spawnedWeapon.GetComponent <WeaponComponent>();
                    GripLocation   = EquippedWeapon.HandPosition;
                    EquippedWeapon.Initialize(this, PlayerController.CrosshairComponent);

                    PlayerEvents.Invoke_OnWeaponEquipped(EquippedWeapon);
                }
            }
        }