List <float> PerformanceMetrics() { float closestOpponentToBallPath = Mathf.Infinity; float closestOpponentToGoalPath = Mathf.Infinity; float distanceToOpponentGoal = Vector3.Distance(transform.position, agentController.otherGoal.position); Transform closestTeammateToBall = utils.GetNearestTeammateToPoint(ball.position); float angleToTeammatePassPath = Vector3.Angle(closestTeammateToBall.forward, (transform.position - closestTeammateToBall.position)); float angleToGoalPath = Vector3.Angle(transform.forward, agentController.otherGoal.position - transform.position); foreach (Transform opponent in utils.opponents) { float ballAngle = Vector3.Angle(opponent.position - ball.position, transform.position - ball.position); float goalAngle = utils.AngleBetweenPoints(agentController.otherGoal.position, opponent.position); closestOpponentToBallPath = (ballAngle < closestOpponentToBallPath)?ballAngle:closestOpponentToBallPath; closestOpponentToGoalPath = (goalAngle < closestOpponentToGoalPath)?goalAngle:closestOpponentToGoalPath; } List <float> metrics = new List <float>(); metrics.Add(Mathf.Clamp01(closestOpponentToBallPath / 90f)); metrics.Add(Mathf.Clamp01(closestOpponentToGoalPath / 90f)); metrics.Add(-Mathf.Clamp01(distanceToOpponentGoal / 10.81f)); metrics.Add(-Mathf.Clamp01(angleToTeammatePassPath / 90f)); metrics.Add(-Mathf.Clamp01(angleToGoalPath / 90f)); return(metrics); }