public void ShowSatelitesInPoint(Vector3 point)
    {
        RemoveAllSatelites();

        var local  = Origin.transform.InverseTransformPoint(point);
        var latLon = ToSpherical(local);
        var sphericalGeocoordinate = new GeoCoordinate(latLon.x, latLon.y);

        var gsProvider = new DataObjectsProvider();
        var satelites  = gsProvider.GetSatellites().Where(sat => sat.IsVisibleFromPointNow(sphericalGeocoordinate)).Take(3).ToArray();

        var cameraMain = Camera.main.transform;

        var positions = new Vector3[3] {
            cameraMain.forward + new Vector3(40f, 7f, 30f),
            cameraMain.forward + new Vector3(25f, 7f, 30f),
            cameraMain.forward + new Vector3(5f, 7f, 20f),
        };

        for (var i = 0; i < satelites.Length; i++)
        {
            var worldSatelite = CreateWorldSatelite($"{satelites[i].ObjectName}");
            worldSatelite.transform.position = positions[i];


            var satellite = worldSatelite.AddComponent <SatelliteObject>();
            satellite.Init(satelites[i]);
            satellite.OnStationSelected(OnSatelliteSelected);

            _statellits.Add(satelites[i].ObjectId, satellite);
        }
    }
Ejemplo n.º 2
0
        private void Start()
        {
            int c              = 0;
            var gsProvider     = new DataObjectsProvider();
            var groundStations = gsProvider.GetSatellites();

            foreach (var gs in groundStations)
            {
                var gsInstance = Instantiate(Sputnik);
                gsInstance.name = gs.ObjectId;

                var satellite = gsInstance.AddComponent <SatelliteObject>();
                satellite.Init(gs);
                satellite.OnStationSelected(OnSatelliteSelected);

                _statellits.Add(gs.ObjectId, satellite);
            }
        }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        var gsProvider     = new DataObjectsProvider();
        var groundStations = gsProvider.GetGroundStations();

        foreach (var gs in groundStations)
        {
            var gsInstance = Instantiate(GroundStationPrefab);
            gsInstance.name = gs.Id;
            gsInstance.transform.SetParent(Container, false);

            var geoObj = gsInstance.AddComponent <GeoObject>();
            geoObj.EarthObjectRadius = EarthCollider.radius;
            geoObj.SetCoordinates(gs.Location.Latitude, gs.Location.Longitude);
            geoObj.GetComponent <GroundStationObject>().Init(gs);
            geoObj.GetComponent <GroundStationObject>().OnStationSelected(StationSelected);

            _groundObjects.Add(gs.Id, geoObj.GetComponent <GroundStationObject>());
        }
    }
Ejemplo n.º 4
0
    private void ShowAllSatelites()
    {
        var gsProvider = new DataObjectsProvider();
        var satelites  = gsProvider.GetSatellites();

        foreach (var sat in satelites)
        {
            var satelite     = CreateSatelite($"{sat.ObjectName}");
            var sateliteData = sat.GetGeodeticCoordinateNow();

            satelite.GetComponent <ClipableHandler>().OrbitFactory = OrbitFactory;

            var satellite = satelite.gameObject.AddComponent <SatelliteObject>();
            satellite.Init(sat);
            satellite.OnStationSelected(OnSatelliteSelected);


            _statellits.Add(sat.ObjectId, satellite);


            var altitude = sateliteData.Altitude / (EARTH_RADIUS_IN_METERS / EarthCollider.radius);
            satelite.SetCoordinates(sateliteData.Latitude, sateliteData.Longitude, altitude);
        }
    }