Skip to content
Snippets Groups Projects
Commit 884ba916 authored by MrWarzo's avatar MrWarzo 💬
Browse files

Merge branch 'jordan.pereira-main-patch-27794' into 'main'

Update Runners.cs

See merge request !74
parents 195bb3a4 4597cae1
1 merge request!74Update Runners.cs
namespace Scripts.IA namespace Scripts.IA
{ {
using UnityEngine; using UnityEngine;
using Scripts.Waypoints; using Scripts.Waypoints;
using Mapbox.Utils; using Mapbox.Utils;
using Mapbox.Unity.Map; using Mapbox.Unity.Map;
//! @authors Wakestufou
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
public class Runners : MonoBehaviour public class Runners : MonoBehaviour
{ {
public float speed = 10f; // Champs publiques
public float motivation; public float speed = 10f; //<! "Insérer description de la variable"
private AbstractMap _map; public float motivation; //<! "Insérer description de la variable"
private Vector3 target; // Champs privés
private int waypointIndex = 0; private Vector3 target; //<! "Insérer description de la variable"
private int waypointIndex = 0; //<! "Insérer description de la variable"
private AbstractMap _map; //<! "Insérer description de la variable"
//! @brief Se lance au lancement du script.
//! @details "Insérer description détaillée"
void Start() void Start()
{ {
motivation = 50f; motivation = 50f;
...@@ -26,6 +33,8 @@ ...@@ -26,6 +33,8 @@
speed = vitesse; speed = vitesse;
} }
//! @brief Se répète toutes les 14ms (temps par défaut dans Unity).
//! @details "Insérer description détaillée"
private void Update() private void Update()
{ {
Vector3 dir = target - transform.position; Vector3 dir = target - transform.position;
...@@ -52,6 +61,8 @@ ...@@ -52,6 +61,8 @@
if (motivation <= 0) Destroy(gameObject); if (motivation <= 0) Destroy(gameObject);
} }
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
private void GetNextWaypoint() private void GetNextWaypoint()
{ {
Debug.Log(target.ToString()); Debug.Log(target.ToString());
...@@ -65,4 +76,4 @@ ...@@ -65,4 +76,4 @@
target = _map.GeoToWorldPosition(WaypointsFactory.getInstance().getWp()[waypointIndex]); target = _map.GeoToWorldPosition(WaypointsFactory.getInstance().getWp()[waypointIndex]);
} }
} }
} }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment