Exemplo n.º 1
0
    public static int GetBestRespawnPoint(Vector3[] respawnPoints, Vector3[] enemies, Vector3[] allies)
    {
        RespawnPoint[] points = new RespawnPoint[respawnPoints.Length];

        for (int i = 0; i < respawnPoints.Length; i++)
        {
            points[i] = new RespawnPoint()
            {
                pos         = respawnPoints[i],
                idFromArray = i,
                value       = 0
            };
        }

        for (int i = 0; i < points.Length; i++)
        {
            EvaluateRespawnPoint(ref points[i], enemies, allies);
        }

        points = points.OrderBy(p => p.value).ToArray();

        return(points[0].idFromArray);
    }