added endscreen
This commit is contained in:
1 parent
a33eb50ca0
commit
2b01c50795
15 files changed
+989
-88
No files matched your search
@@ -47,12 +47,12 @@ namespace Code.Gameplay.Weapons
|
||||
var damageable = hit.collider.GetComponentInParent<IDamageable>();
|
||||
damageable?.TakeDamage(_damage);
|
||||
|
||||
if (impactEffect != null)
|
||||
if (impactEffect)
|
||||
{
|
||||
Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal));
|
||||
}
|
||||
|
||||
if (impactSound != null && _audioSource != null)
|
||||
if (impactSound && _audioSource)
|
||||
{
|
||||
_audioSource.PlayOneShot(impactSound);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ namespace Code.Gameplay.Weapons
|
||||
{
|
||||
public class Rifle : WeaponBase
|
||||
{
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
@@ -104,10 +104,10 @@ namespace Code.Gameplay.Weapons
|
||||
|
||||
SpawnBullet();
|
||||
|
||||
if (muzzleFlash != null)
|
||||
if (muzzleFlash)
|
||||
muzzleFlash.Play();
|
||||
|
||||
if (shootSound != null)
|
||||
if (shootSound)
|
||||
audioSource.PlayOneShot(shootSound);
|
||||
|
||||
OnShoot();
|
||||
@@ -115,7 +115,7 @@ namespace Code.Gameplay.Weapons
|
||||
|
||||
protected virtual void SpawnBullet()
|
||||
{
|
||||
if (bulletPrefab == null) return;
|
||||
if (!bulletPrefab) return;
|
||||
|
||||
var spread = Random.insideUnitSphere * (spreadAngle / 100f);
|
||||
var direction = (_firePoint.forward + spread).normalized;
|
||||
@@ -123,7 +123,7 @@ namespace Code.Gameplay.Weapons
|
||||
var bullet = Instantiate(bulletPrefab, _firePoint.position, Quaternion.LookRotation(direction));
|
||||
var bulletComponent = bullet.GetComponent<Bullet>();
|
||||
|
||||
if (bulletComponent != null)
|
||||
if (bulletComponent)
|
||||
{
|
||||
bulletComponent.Initialize(bulletSpeed, damage, direction);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ namespace Code.Gameplay.Weapons
|
||||
{
|
||||
isReloading = true;
|
||||
|
||||
if (reloadSound != null)
|
||||
if (reloadSound)
|
||||
audioSource.PlayOneShot(reloadSound);
|
||||
|
||||
yield return new WaitForSeconds(reloadTime);
|
||||
@@ -178,7 +178,7 @@ namespace Code.Gameplay.Weapons
|
||||
if (Time.time - lastShotTryTime < fireRate)
|
||||
return;
|
||||
lastShotTryTime = Time.time;
|
||||
if (emptySound != null)
|
||||
if (emptySound)
|
||||
audioSource.PlayOneShot(emptySound);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user