public override void AgentAction(float[] vectorAction, string textAction) { if (killtext && deathtext) { killtext.text = "Kills: " + kills; deathtext.text = "Deaths: " + deaths; } //Debug.Log(controller.isAlive); //Debug.Log(vectorAction[0] + " :: "+ vectorAction[1] + " :: " + vectorAction[2] + " :: " + vectorAction[3] + " :: " + vectorAction[4]); /*Generates 5 actions in 6 actions * Move, (can only move in the direction it is facing, so no extra variables for moving left/right/backwards) * Rotate * Shoot (only available if canshoot is true, but can still be attempted) * Reload * Change Weapon (like shoot, can be called even if it physically cant change weapon) */ if (brain.brainParameters.vectorActionSpaceType == SpaceType.discrete) { //Move agent using first two actions as movement and rotation amounts controller.Move(new Vector2(vectorAction[0], vectorAction[1])); //Decides whether agent should shoot (clamped to 0 or 1 for dont shoot and shoot) controller.Shoot(vectorAction[2]); //Decides whether agent should reload (clamped to 0 or 1 for dont reload and reload) controller.Reload(vectorAction[3]); //Decides to change weapon (0 for dont, 1 - 5 for which weapon to attempt to change to) //controller.ChangeWeapon(vectorAction[4]); } //Set previous position to the current previousPosition = gameObject.transform.position; //Trigger if the controller has died if (!controller.isAlive) { deaths++; if (controller.isRecording) { controller.recordingKillCounter.text = deaths.ToString(); } //AddReward(deathPenalty); Done(); } else { AddReward(0.0001f); } }