This commit is contained in:
2025-09-17 18:56:28 +08:00
commit 54c72710a5
5244 changed files with 5717609 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);
}
}
}