/// <summary> /// Fires the weapon's primary feature /// </summary> void IWeapon.BeginFiringPrimary(WeaponFiringDirection firingDirection) { float lifeTime = 2.0f; float launchForceMagnitude = 8.0f; LaunchProjectile(bulletPrefabName, muzzleTip.position, transform.parent.parent.localRotation, lifeTime, transform.right * launchForceMagnitude); }
/// <summary> /// Fires the weapon's primary feature /// </summary> void IWeapon.BeginFiringPrimary(WeaponFiringDirection firingDirection, Color color) { float lifeTime = 1.0f; float launchForceMagnitude = 5.0f; LaunchProjectile(bulletPrefabName, muzzleTip.position, transform.parent.parent.localRotation, lifeTime, Vector3.up * 10.0f + transform.right * launchForceMagnitude, color); }
/// <summary> /// Fires the weapon's primary feature /// </summary> void IWeapon.BeginFiringPrimary(WeaponFiringDirection firingDirection) { float lifeTime = 0.75f; float launchForceMagnitude = 10.0f; Vector3 v = (firingDirection == WeaponFiringDirection.LocalAxis) ? transform.right : new Vector3(transform.right.x,0,0).normalized; LaunchProjectile(bulletPrefabName, muzzleTip.position, transform.parent.parent.localRotation, lifeTime, v * launchForceMagnitude); }
/// <summary> /// Fires the weapon's primary feature /// </summary> void IWeapon.BeginFiringPrimary(WeaponFiringDirection firingDirection) { if (CanFire) { float lifeTime = 0.6f; float launchForceMagnitude = 10.0f; for (int i=0; i < shellsPerShot; i++) { Vector3 v = (firingDirection == WeaponFiringDirection.LocalAxis) ? transform.right : new Vector3(transform.right.x,0,0).normalized; Vector3 f = v * launchForceMagnitude; f = Quaternion.AngleAxis(Mathf.Lerp(-30.0f,30.0f,(float)i / (shellsPerShot-1)),Vector3.forward) * f; LaunchProjectile(bulletPrefabName, muzzleTip.position, transform.parent.parent.localRotation, lifeTime, f); // If this isn't the final shot, we have to reset the timer if (i < shellsPerShot - 1) { ResetTimeLastFired(); } } } }
/// <summary> /// Fires the weapon's primary feature /// </summary> void IWeapon.BeginFiringPrimary(WeaponFiringDirection firingDirection) { // Knives do not have projectiles }