This commit is contained in:
2025-06-16 15:14:23 +02:00
committed by devbeni
parent 60fe4620ff
commit 4ff561284f
3174 changed files with 428263 additions and 0 deletions

View File

@ -0,0 +1,30 @@
using Mirror.Examples.Common.Controllers.Tank;
using UnityEngine;
namespace Mirror.Examples.TankTheftAuto
{
[AddComponentMenu("")]
public class TankTheftAutoNetMan : NetworkManager
{
public override void OnServerDisconnect(NetworkConnectionToClient conn)
{
// If the client was driving a tank, destroy the cached player object
if (conn.authenticationData is GameObject player)
NetworkServer.Destroy(player);
if (conn.identity != null)
{
if (conn.identity.TryGetComponent(out TankTurretBase tankTurret))
tankTurret.playerColor = Color.black;
if (conn.identity.TryGetComponent(out TankAuthority tankAuthority))
{
tankAuthority.isControlled = false;
NetworkServer.RemovePlayerForConnection(conn, RemovePlayerOptions.KeepActive);
}
}
base.OnServerDisconnect(conn);
}
}
}