45 lines
916 B
C#
45 lines
916 B
C#
using UnityEngine;
|
|
using Unity.MLAgents;
|
|
using Unity.MLAgents.Actuators;
|
|
using Unity.MLAgents.Sensors;
|
|
using System.Collections.Generic;
|
|
using Unity.MLAgents.Policies;
|
|
using Unity.VisualScripting;
|
|
using Unity.Barracuda;
|
|
using System;
|
|
|
|
public class OmnicientBehaviour : PlayerBehaviour
|
|
{
|
|
public int frames = 0;
|
|
public bool boolean;
|
|
protected override sbyte ChooseDirection()
|
|
{
|
|
if (frames == 0)
|
|
{
|
|
boolean = (DateTime.Now.Millisecond) % 2 == 0;
|
|
}
|
|
frames++;
|
|
if (frames >= 5)
|
|
{
|
|
frames = 0;
|
|
}
|
|
|
|
return boolean ? (sbyte)1 : (sbyte)-1;
|
|
}
|
|
|
|
protected override string ChoosePlayerName()
|
|
{
|
|
return "Omnicient";
|
|
}
|
|
|
|
protected override Color ChoosePlayerColor()
|
|
{
|
|
return new Color(0, 0, 255);
|
|
}
|
|
|
|
protected override bool ChooseIfPlayerIsHuman()
|
|
{
|
|
return false;
|
|
}
|
|
}
|