38 lines
953 B
C#
Executable File
38 lines
953 B
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Unity.MLAgents;
|
|
using Unity.MLAgents.Sensors;
|
|
|
|
public class NPC : Agent
|
|
{
|
|
public float LastTimeHit;
|
|
private BaseBehaviour NPCBehaviour;
|
|
public List<Action> ActionList;
|
|
|
|
[SerializeField]
|
|
private List<ISensor> SensorList; // todo тут интерфейс должен быть наш
|
|
|
|
public void SetBehaviour(BaseBehaviour behaviour) => NPCBehaviour = behaviour;
|
|
public Team Team { get; set; }
|
|
private void Start()
|
|
{
|
|
|
|
}
|
|
|
|
public override void CollectObservations(VectorSensor sensor)
|
|
{
|
|
// Target and Agent positions
|
|
foreach (var _sensor in SensorList)
|
|
{
|
|
sensor.AddObservation(1); // todo
|
|
// sensor.AddObservation(_sensor.GetValue());
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
//NPCBehaviour.DoAction();
|
|
}
|
|
}
|