Exemplo n.º 1
0
    private void checkOpenSpawnPoint()
    {
        Vector3    location          = drone.getCoords();
        float      closest           = float.PositiveInfinity;
        SpawnPoint closestSpawnPoint = null;

        foreach (SpawnPoint spawnPoint in spawnPoints)
        {
            if (spawnPoint.isActiveAndEnabled)
            {
                Vector3 spawnLocation = spawnPoint.getCoords();
                float   distance      = Vector3.Distance(location, spawnLocation);
                if (distance < closest)
                {
                    closest           = distance;
                    closestSpawnPoint = spawnPoint;
                }
            }
        }
        if (closest < 2 && closestSpawnPoint != null)
        {
            pauseMenuController.openSpawnPoint(closestSpawnPoint);
        }
        else
        {
            pauseMenuController.openSpawnPoint(null);
        }
        canToggleSpawnPoint = false;
    }