Added map and fixed other bugs
This commit is contained in:
@@ -11,6 +11,7 @@ public class PlayerShoot : NetworkBehaviour
|
||||
|
||||
private PlayerHealth playerHealth;
|
||||
private WeaponView weaponView;
|
||||
private PlayerShield playerShield;
|
||||
|
||||
private bool isActive = false;
|
||||
|
||||
@@ -19,6 +20,7 @@ public class PlayerShoot : NetworkBehaviour
|
||||
isActive = true;
|
||||
|
||||
playerHealth = GetComponent<PlayerHealth>();
|
||||
playerShield = GetComponent<PlayerShield>();
|
||||
weaponView = GetComponentInChildren<WeaponView>(true);
|
||||
}
|
||||
|
||||
@@ -27,6 +29,7 @@ public class PlayerShoot : NetworkBehaviour
|
||||
if (!isActive) return;
|
||||
|
||||
if (playerHealth == null || playerHealth.isDead.Value) return;
|
||||
if (playerShield != null && playerShield.IsShieldUp) return;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
@@ -50,7 +53,8 @@ public class PlayerShoot : NetworkBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (_hit.collider.TryGetComponent(out PlayerHealth _playerHealth))
|
||||
PlayerHealth _playerHealth = _hit.collider.GetComponentInParent<PlayerHealth>();
|
||||
if (_playerHealth != null)
|
||||
{
|
||||
_playerHealth.TakeDamage((int)damageAmount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user