Aimbot-ParallelEnv/Assets/Script/InGame/AimBotSideChennelController.cs
Koha9 cfccd12820 V3.1.1 优化代码
优化可读性与规范化命名方式
2023-06-30 18:30:12 +09:00

31 lines
949 B
C#

using Unity.MLAgents;
using Unity.MLAgents.SideChannels;
using UnityEngine;
public class AimBotSideChennelController : MonoBehaviour
{
public AimbotSideChannel aimbotSideChannel;
public void Awake()
{
// We create the Side Channel
aimbotSideChannel = new AimbotSideChannel();
// When a Debug.Log message is created, we send it to the stringChannel
Application.logMessageReceived += aimbotSideChannel.SendDebugStatementToPython;
// The channel must be registered with the SideChannelManager class
SideChannelManager.RegisterSideChannel(aimbotSideChannel);
}
// Side Channel
public void OnDestroy()
{
// De-register the Debug.Log callback
Application.logMessageReceived -= aimbotSideChannel.SendDebugStatementToPython;
if (Academy.IsInitialized)
{
SideChannelManager.UnregisterSideChannel(aimbotSideChannel);
}
}
}