enemy spawner
This commit is contained in:
@@ -50,10 +50,7 @@ namespace MegaKoop.Game.Networking
|
||||
|
||||
weaponController.ProjectileSpawned += OnProjectileSpawned;
|
||||
|
||||
if (!IsAuthoritative() && disableLocalFiringWhenClient)
|
||||
{
|
||||
weaponController.enabled = false;
|
||||
}
|
||||
ApplyLocalAuthoritySetting();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
@@ -62,9 +59,9 @@ namespace MegaKoop.Game.Networking
|
||||
{
|
||||
weaponController.ProjectileSpawned -= OnProjectileSpawned;
|
||||
|
||||
if (!IsAuthoritative() && disableLocalFiringWhenClient)
|
||||
if (disableLocalFiringWhenClient)
|
||||
{
|
||||
weaponController.enabled = true;
|
||||
weaponController.SetLocalAuthority(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,5 +121,16 @@ namespace MegaKoop.Game.Networking
|
||||
|
||||
weaponController.SpawnNetworkProjectile(spawnMessage.WeaponIndex, spawnMessage.Position, spawnMessage.Direction, spawnMessage.Speed, spawnMessage.Life, spawnMessage.Damage);
|
||||
}
|
||||
|
||||
private void ApplyLocalAuthoritySetting()
|
||||
{
|
||||
if (weaponController == null || !disableLocalFiringWhenClient)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool allowLocalControl = IsAuthoritative();
|
||||
weaponController.SetLocalAuthority(allowLocalControl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user