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); }
// 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); }
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); }
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); }
// 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); } } }