private void PutWeaponInHand(WeaponConfig weapon) { if (weaponObject != null) { Destroy(weaponObject); } Transform weaponSocket = null; switch (weapon.GetHand()) { case Hand.OffHand: weaponSocket = RequestOffHand(); break; case Hand.DominantHand: weaponSocket = RequestDominantHand(); break; } weaponObject = Instantiate(weapon.GetWeaponPrefab(), weaponSocket); var weaponGrip = weapon.getWeaponGrip(); weaponObject.transform.localPosition = weaponGrip.transform.position; weaponObject.transform.localRotation = weaponGrip.transform.rotation; weaponObject.transform.localScale = weaponGrip.transform.localScale; animator.SetFloat("AttackAnimationSpeedMultiplier", weapon.GetAttackSpeedMultiplier()); heldWeapon = weapon; }
private void UpdateWeapon() { cachedConfig = weaponConfig; DestroyAllChildren(); var weaponObject = Instantiate(weaponConfig.GetWeaponPrefab(), transform); weaponObject.transform.localPosition = Vector3.zero; }
private void DoEditModeUpdate() { if (cachedConfig == null) { cachedConfig = weaponConfig; } if (cachedConfig != weaponConfig) { UpdateWeapon(); } }