Runtime bot behavior instantiation

This commit is contained in:
2022-05-07 23:08:32 +07:00
parent 8cce356b8e
commit 6aa872c92f

View File

@ -1,4 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Unity.Barracuda;
using Unity.MLAgents.Policies;
using UnityEngine; using UnityEngine;
public class CharacterFactory : MonoBehaviour public class CharacterFactory : MonoBehaviour
@ -70,7 +72,9 @@ public class CharacterFactory : MonoBehaviour
} }
else else
{ {
gameobject.GetComponent<NPC>().GetCharacter.Team = team; var npc = gameobject.GetComponent<NPC>();
npc.GetCharacter.Team = team;
npc.SetModel(team.ToString(), ScriptableObject.CreateInstance<NNModel>(), InferenceDevice.Default );
gameobject.GetComponent<MovementController>().PointStartID = spawnPoint.PointId; gameobject.GetComponent<MovementController>().PointStartID = spawnPoint.PointId;
bots.Add(gameobject); bots.Add(gameobject);
} }