From 7616712f21b30741c95e0a20574802094a1760ce Mon Sep 17 00:00:00 2001 From: Joffrey LE CUDENEC <joffrey.le-cudenec@etu.unistra.fr> Date: Thu, 16 Dec 2021 21:50:31 +0100 Subject: [PATCH] Correction sur la correction de la route --- T3-Unity/Assets/Scenes/Map_Tests1.unity | 11 +++++-- .../Assets/Scripts/Waypoints/SpawnOnMap.cs | 33 ++++++++++++++++--- .../Scripts/Waypoints/WaypointsFactory.cs | 7 ++-- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/T3-Unity/Assets/Scenes/Map_Tests1.unity b/T3-Unity/Assets/Scenes/Map_Tests1.unity index 5688716..2a33381 100644 --- a/T3-Unity/Assets/Scenes/Map_Tests1.unity +++ b/T3-Unity/Assets/Scenes/Map_Tests1.unity @@ -1043,7 +1043,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: -0.0000075172, y: -45.3} + m_AnchoredPosition: {x: -0.0000075172, y: -45.30005} m_SizeDelta: {x: 915.99805, y: 83.7728} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &567138931 @@ -1730,8 +1730,13 @@ MonoBehaviour: _map: {fileID: 703254553} _locations: [] _spawnScale: 1 + _spawnScaleStartEnd: 6 _markerPrefab: {fileID: 901362092215755285, guid: 18761a72aa6233c4bb4bd29dd401981e, type: 3} + _prefabDebut: {fileID: 2042676738254883600, guid: adcf133badada334581b9bd798be23cd, + type: 3} + _prefabFin: {fileID: 5106668611982552037, guid: 6a798f905f6b7dd4ea45b512de8e4537, + type: 3} _spawnedObjects: [] parent: {fileID: 1041475211} --- !u!1 &729711190 @@ -2616,7 +2621,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: -637, y: -117.34} + m_AnchoredPosition: {x: -637, y: -117.34009} m_SizeDelta: {x: 190.2688, y: 75.3916} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1108485021 @@ -3391,7 +3396,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: -860, y: -117.34} + m_AnchoredPosition: {x: -860, y: -117.34009} m_SizeDelta: {x: 199.99994, y: 75.38324} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1463677837 diff --git a/T3-Unity/Assets/Scripts/Waypoints/SpawnOnMap.cs b/T3-Unity/Assets/Scripts/Waypoints/SpawnOnMap.cs index 2e77e88..5f00eec 100644 --- a/T3-Unity/Assets/Scripts/Waypoints/SpawnOnMap.cs +++ b/T3-Unity/Assets/Scripts/Waypoints/SpawnOnMap.cs @@ -21,9 +21,18 @@ [SerializeField] float _spawnScale = 1f; + [SerializeField] + float _spawnScaleStartEnd = 6f; + [SerializeField] GameObject _markerPrefab; + [SerializeField] + GameObject _prefabDebut; + + [SerializeField] + GameObject _prefabFin; + public List<GameObject> _spawnedObjects; public Transform parent; @@ -39,10 +48,24 @@ for (int i = 0; i < _locations.Length; i++) { _locations[i] = Waypoints[i]; - var instance = Instantiate(_markerPrefab, parent); - instance.transform.localPosition = _map.GeoToWorldPosition(_locations[i], true); - instance.transform.localScale = new Vector3(_spawnScale, _spawnScale, _spawnScale); - _spawnedObjects.Add(instance); + var instances = Instantiate(_markerPrefab, parent); ; + if (i == 0) + { + instances = Instantiate(_prefabDebut, parent); + instances.transform.localScale = new Vector3(_spawnScaleStartEnd, _spawnScaleStartEnd, _spawnScaleStartEnd); + } + else if (i == _locations.Length - 1) + { + instances = Instantiate(_prefabFin, parent); + instances.transform.localScale = new Vector3(_spawnScaleStartEnd, _spawnScaleStartEnd, _spawnScaleStartEnd); + } + else + { + instances.transform.localScale = new Vector3(_spawnScale, _spawnScale, _spawnScale); + } + + instances.transform.localPosition = _map.GeoToWorldPosition(_locations[i], true); + _spawnedObjects.Add(instances); } //GameObject.Find("Map").GetComponent<QuadTreeCameraMovement>().enabled = true; //_cam = GameObject.Find("GameManager").GetComponent<QuadTreeCameraMovement>(); @@ -73,7 +96,7 @@ } else { - _zoom--; + _zoom -= 0.25f; _map.UpdateMap(_map.CenterLatitudeLongitude, _zoom); } } diff --git a/T3-Unity/Assets/Scripts/Waypoints/WaypointsFactory.cs b/T3-Unity/Assets/Scripts/Waypoints/WaypointsFactory.cs index dc302fa..f9d68c0 100644 --- a/T3-Unity/Assets/Scripts/Waypoints/WaypointsFactory.cs +++ b/T3-Unity/Assets/Scripts/Waypoints/WaypointsFactory.cs @@ -63,7 +63,6 @@ void Route() { - //_coordinates[0] = new Vector2d(double.Parse(coordonnee1.Split(',')[0]), double.Parse(coordonnee1.Split(',')[1])); _coordinates[0] = Conversions.StringToLatLon(coordonnee1); _coordinates[1] = Conversions.StringToLatLon(coordonnee2); _directionResource.Coordinates = _coordinates; @@ -73,7 +72,7 @@ void HandleDirectionsResponse(DirectionsResponse res) { DirectionResourceResultat = res; - var data = JsonConvert.SerializeObject(res, Formatting.Indented, JsonConverters.Converters); + //var data = JsonConvert.SerializeObject(res, Formatting.Indented, JsonConverters.Converters); test = false; } @@ -108,6 +107,10 @@ } PlacementWaypoint(abstractmap.WorldToGeoPosition(GameObject.FindGameObjectWithTag("end_wp").transform.position)); + + GameObject.FindGameObjectWithTag("start_wp").Destroy(); + GameObject.FindGameObjectWithTag("end_wp").Destroy(); + map.GetComponent<SpawnOnMap>().enabled = true; } } -- GitLab