public void ToggleWeaponVisibility(bool visible, SynchedMissionObject weapon)
 {
     if ((NativeObject)weapon.GameEntity.Parent != (NativeObject)null && weapon.GameEntity.Parent.HasScriptOfType <SynchedMissionObject>())
     {
         weapon.GameEntity.Parent.GetScriptComponents <SynchedMissionObject>().First <SynchedMissionObject>().SetVisibleSynched(visible);
         weapon.GameEntity.Parent.GetScriptComponents <SynchedMissionObject>().First <SynchedMissionObject>().SetPhysicsStateSynched(visible);
     }
     else
     {
         weapon?.SetVisibleSynched(visible);
         weapon?.SetPhysicsStateSynched(visible);
     }
 }
        private void OnDeploymentStateChangedAux(SynchedMissionObject targetObject)
        {
            if (this.IsDeployed)
            {
                targetObject.SetVisibleSynched(true);
                targetObject.SetPhysicsStateSynched(true);
            }
            else
            {
                targetObject.SetVisibleSynched(false);
                targetObject.SetPhysicsStateSynched(false);
            }
            Action <DeploymentPoint> deploymentStateChanged = this.OnDeploymentStateChanged;

            if (deploymentStateChanged != null)
            {
                deploymentStateChanged(this);
            }
            if (!(targetObject is SiegeWeapon siegeWeapon))
            {
                return;
            }
            siegeWeapon.OnDeploymentStateChanged(this.IsDeployed);
        }