Skip to content
Snippets Groups Projects
Commit 4597cae1 authored by MrWarzo's avatar MrWarzo :speech_balloon:
Browse files

Update Runners.cs

parent 195bb3a4
1 merge request!74Update Runners.cs
namespace Scripts.IA
namespace Scripts.IA
{
using UnityEngine;
using Scripts.Waypoints;
using Mapbox.Utils;
using Mapbox.Unity.Map;
//! @authors Wakestufou
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
public class Runners : MonoBehaviour
{
public float speed = 10f;
public float motivation;
private AbstractMap _map;
// Champs publiques
public float speed = 10f; //<! "Insérer description de la variable"
public float motivation; //<! "Insérer description de la variable"
private Vector3 target;
private int waypointIndex = 0;
// Champs privés
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()
{
motivation = 50f;
......@@ -26,6 +33,8 @@
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()
{
Vector3 dir = target - transform.position;
......@@ -52,6 +61,8 @@
if (motivation <= 0) Destroy(gameObject);
}
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
private void GetNextWaypoint()
{
Debug.Log(target.ToString());
......@@ -65,4 +76,4 @@
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