This commit is contained in:
Andrey Gumirov
2022-04-18 19:01:06 +07:00
parent e1d0bbc1eb
commit 4bd1e0644a
8 changed files with 54 additions and 22 deletions

View File

@ -54,24 +54,29 @@ public class NPC : Agent, ICharacter
sensor.AddObservation(Condition.HealthPoints);
sensor.AddObservation(Condition.ArmourPoints);
sensor.AddObservation(Condition.Ammunition);
sensor.AddObservation((int)NPC_State.State);
sensor.AddObservation((int) NPC_State.State);
var candidates = moveController.getPointsCandidate();
foreach (var point in candidates)
{
bufferSensor.AppendObservation(new float[] {
var parray = new float[]
{
//1 position in navpointId
(float)moveController.currentPosition.PointId,
(float) moveController.currentPosition.PointId,
//2 distance to flag
moveController.currentPosition.FlagDistance,
//3 death count in point
moveController.currentPosition.DeathAttr,
//4 flagEnemyDistance
GameManager.IsCloserToFlagFromNextNavPoint(point, transform.position)==true?1:0,
GameManager.IsCloserToFlagFromNextNavPoint(point, transform.position) == true ? 1 : 0,
//5 EnemyVsNavPointDistance
GameManager.IsCloserToEnemyThanToNextNavPoint(point,transform.position, AgentCharacter.Team)==true?1:0
});
GameManager.IsCloserToEnemyThanToNextNavPoint(point, transform.position, AgentCharacter.Team) == true
? 1
: 0
};
var _parray = string.Join(" ", parray);
Debug.Log("OBS: " + _parray);
bufferSensor.AppendObservation(parray);
}
}
@ -90,6 +95,9 @@ public class NPC : Agent, ICharacter
{
moveController.MoveToRandomPoint();
NPC_State = RunningState;
} else if (actions.DiscreteActions[0] == 2)
{
moveController.MoveToPointById(actions.DiscreteActions[1]);
}
}