|
|
|
|
|
|
[HideInInspector] |
|
|
|
public BehaviorParameters m_BehaviorParameters; |
|
|
|
|
|
|
|
|
|
|
|
// [Header("DUMB AI HEURISTIC")] public bool DoNotPerformActions;
|
|
|
|
//PLAYER STATE TO OBSERVE
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
|
{ |
|
|
|
if (UseVectorObs) |
|
|
|
{ |
|
|
|
sensor.AddObservation(StepCount / (float)MaxStep); //Help with credit assign?
|
|
|
|
sensor.AddObservation(currentNumberOfBalls/4); //Held DBs Normalized
|
|
|
|
sensor.AddObservation(HitPointsRemaining/NumberOfTimesPlayerCanBeHit); //Remaining Hit Points Normalized
|
|
|
|
// sensor.AddObservation((float)StepCount / (float)MaxStep); //Helps with credit assign?
|
|
|
|
sensor.AddObservation((float)currentNumberOfBalls/4); //Held DBs Normalized
|
|
|
|
sensor.AddObservation((float)HitPointsRemaining/(float)NumberOfTimesPlayerCanBeHit); //Remaining Hit Points Normalized
|
|
|
|
// // var localVelocity = transform.InverseTransformDirection(m_AgentRb.velocity);
|
|
|
|
// // sensor.AddObservation(localVelocity.x);
|
|
|
|
// // sensor.AddObservation(localVelocity.z);
|
|
|
|
|
|
|
|
|
|
|
public void MoveAgent(ActionSegment<float> act) |
|
|
|
{ |
|
|
|
// if (DoNotPerformActions)
|
|
|
|
// {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// if (!m_Frozen)
|
|
|
|
// {
|
|
|
|
// var shootCommand = false;
|
|
|
|
|
|
|
|
|
|
|
//HANDLE THROWING
|
|
|
|
if (m_ThrowInput > 0) |
|
|
|
// if (input.shootPressed)
|
|
|
|
{ |
|
|
|
ThrowTheBall(); |
|
|
|
} |
|
|
|
|
|
|
public float m_InputH; |
|
|
|
private float m_InputV; |
|
|
|
private float m_Rotate; |
|
|
|
public bool leftStrafe; |
|
|
|
public bool rightStrafe; |
|
|
|
|
|
|
|
// void Update()
|
|
|
|
// {
|
|
|
|
|
|
|
if (db.TeamToIgnore != -1 && db.TeamToIgnore != m_BehaviorParameters.TeamId) //HIT BY LIVE BALL
|
|
|
|
{ |
|
|
|
m_GameController.PlayerWasHit(this); |
|
|
|
PlayHitFX(); |
|
|
|
// if (HitPointsRemaining == 1)
|
|
|
|
// {
|
|
|
|
// //RESET ENV
|
|
|
|
|
|
|
// contActionsOut[2] = input.rotateInput.x; //rotate
|
|
|
|
contActionsOut[2] = input.rotateInput.x; //rotate
|
|
|
|
// contActionsOut[3] = input.shootInput ? 1 : 0; //shoot
|
|
|
|
contActionsOut[3] = input.CheckIfInputSinceLastFrame(ref input.shootInput) ? 1 : 0; //jump
|
|
|
|
contActionsOut[4] = input.CheckIfInputSinceLastFrame(ref input.dashInput) ? 1 : 0; //jump
|
|
|
|
contActionsOut[3] = input.shootPressed ? 1 : 0; //shoot
|
|
|
|
// contActionsOut[3] = input.CheckIfInputSinceLastFrame(ref input.shootInput) ? 1 : 0; //jump
|
|
|
|
// contActionsOut[3] = input.CheckIfInputSinceLastFrame(ref input.shootPressed) ? 1 : 0; //throw
|
|
|
|
contActionsOut[4] = input.CheckIfInputSinceLastFrame(ref input.dashInput) ? 1 : 0; //dash
|
|
|
|
// contActionsOut[5] = input.CheckIfInputSinceLastFrame(ref input.jumpInput) ? 1 : 0; //jump
|
|
|
|
// // contActionsOut[4] = input.jumpInput ? 1 : 0; //jump
|
|
|
|
// // contActionsOut[5] = input.dashInput ? 1 : 0; //dash
|
|
|
|