using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.MLAgents;
using Unity.MLAgents.SideChannels;
using System;

public class AimbotSideChannel : SideChannel
{
    public AimbotSideChannel()
    {
        ChannelId = new Guid("8bbfb62a-99b4-457c-879d-b78b69066b5e");
    }
    protected override void OnMessageReceived(IncomingMessage msg)
    {
        var receivedString = msg.ReadString();
        Debug.Log("From Python : " + receivedString);
    }

    public void SendDebugStatementToPython(string logString, string stackTrace, LogType type)
    {
        if (type == LogType.Warning)
        {
            var stringToSend = "result|"+logString;
            using (var msgOut = new OutgoingMessage())
            {
                msgOut.WriteString(stringToSend);
                QueueMessageToSend(msgOut);
            }
        }
        if (type == LogType.Error)
        {
            var stringToSend = "Error|"+logString;
            using (var msgOut = new OutgoingMessage())
            {
                msgOut.WriteString(stringToSend);
                QueueMessageToSend(msgOut);
            }
        }
    }
}
