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

Template documentation débuts

parent 953a2609
3 merge requests!77Main,!76Template documentation débuts,!72Template documentation débuts
Showing
with 70 additions and 321 deletions
fileFormatVersion: 2 fileFormatVersion: 2
guid: 607157bcd612982428eb831284c1bead guid: 938a99ef3fbf97549b73d5dfa55c7e37
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
...@@ -35,7 +35,7 @@ namespace Scripts ...@@ -35,7 +35,7 @@ namespace Scripts
//! @brief Se répète toutes les 14ms (temps par défaut dans Unity). //! @brief Se répète toutes les 14ms (temps par défaut dans Unity).
//! @details Permet deposer les waypoints START et END à partir du clic et de la position de la souris. //! @details Permet deposer les waypoints START et END à partir du clic et de la position de la souris.
//! Active le script @b Route.RouteTracer de manière à tracer les routes entre les deux waypoints. //! Active le script @b Routes.RouteTracer de manière à tracer les routes entre les deux waypoints.
//! La variable @a indexWaypoint sert à récupérer le préfabriquée voulu dans waypoints et pour noter à quel étape de création est le joueur. //! La variable @a indexWaypoint sert à récupérer le préfabriquée voulu dans waypoints et pour noter à quel étape de création est le joueur.
void Update() void Update()
{ {
...@@ -86,8 +86,6 @@ namespace Scripts ...@@ -86,8 +86,6 @@ namespace Scripts
_indexWaypoint = 4; _indexWaypoint = 4;
} }
//GameObject.Find("GameManager").GetComponent<RouteTracer>().enabled = true;
} }
} }
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: ca46b3b81a6c90243acbcce8edb7659c guid: 58752ef5665804f44bf9dce4e2876b9b
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
private GameObject player;
public float speed;
public float maxY;
public float minY;
private float trueSpeed;
// Start is called before the first frame update
void Start()
{
trueSpeed = speed;
player = GameObject.Find("Player");
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.Z))
{
player.transform.Translate(0, 0, 1 * speed);
}
if (Input.GetKey(KeyCode.Q))
{
player.transform.Translate(-1 * speed, 0, 0);
}
if (Input.GetKey(KeyCode.S))
{
player.transform.Translate(0, 0, -1 * speed);
}
if (Input.GetKey(KeyCode.D))
{
player.transform.Translate(1 * speed, 0, 0);
}
if (Input.GetKey(KeyCode.Space) && player.transform.position.y <= maxY)
{
player.transform.Translate(0, 1 * speed, 0);
}
if (Input.GetKey(KeyCode.LeftControl) && player.transform.position.y >= minY)
{
player.transform.Translate(0, -1 * speed, 0);
}
if (Input.GetKey(KeyCode.LeftShift))
{
speed = 2 * trueSpeed ;
}
else
{
speed = trueSpeed;
}
}
}
fileFormatVersion: 2
guid: cdef371ec6aa3b04e81bb0d5c8dc4b15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -5,15 +5,22 @@ ...@@ -5,15 +5,22 @@
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;
...@@ -48,8 +57,12 @@ ...@@ -48,8 +57,12 @@
{ {
motivation = motivation + (float.Parse(RunnersFactory.getInstance().getRandom().Next(1, 10).ToString()) / 500f); motivation = motivation + (float.Parse(RunnersFactory.getInstance().getRandom().Next(1, 10).ToString()) / 500f);
} }
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());
...@@ -63,4 +76,4 @@ ...@@ -63,4 +76,4 @@
target = _map.GeoToWorldPosition(WaypointsFactory.getInstance().getWp()[waypointIndex]); target = _map.GeoToWorldPosition(WaypointsFactory.getInstance().getWp()[waypointIndex]);
} }
} }
} }
\ No newline at end of file
...@@ -5,17 +5,24 @@ ...@@ -5,17 +5,24 @@
using Mapbox.Unity.Map; using Mapbox.Unity.Map;
using System.Collections.Generic; using System.Collections.Generic;
//! @authors Wakestufou
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
public class RunnersFactory : MonoBehaviour public class RunnersFactory : MonoBehaviour
{ {
public int nbJoueur; // Champs publiques
public Transform parent; public int nbJoueur; //<! "Insérer description de la variable"
public Runners copy; public Transform parent; //<! "Insérer description de la variable"
private System.Random rdn; public Runners copy; //<! "Insérer description de la variable"
private static RunnersFactory instance; public List<GameObject> _listRunners; //<! "Insérer description de la variable"
private AbstractMap _map; public float moyenneMotivation = 0; //<! "Insérer description de la variable"
public List<GameObject> _listRunners;
public float moyenneMotivation = 0;
private System.Random rdn; //<! "Insérer description de la variable"
private static RunnersFactory instance; //<! "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()
{ {
_listRunners = new List<GameObject>(); _listRunners = new List<GameObject>();
...@@ -23,7 +30,7 @@ ...@@ -23,7 +30,7 @@
instance = this; instance = this;
rdn = new System.Random(); rdn = new System.Random();
nbJoueur = 5 + Ui.rep * 2; nbJoueur = 5 + Ui.fame * 2;
for (int i = 0; i < nbJoueur; i++) for (int i = 0; i < nbJoueur; i++)
{ {
...@@ -35,11 +42,13 @@ ...@@ -35,11 +42,13 @@
moyenneMotivation /= float.Parse(_listRunners.Count.ToString()); moyenneMotivation /= float.Parse(_listRunners.Count.ToString());
} }
//! @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()
{ {
_listRunners.Clear(); _listRunners.Clear();
moyenneMotivation = 0; moyenneMotivation = 0;
for (int i = 0; i<GameObject.Find("Sportifs").transform.childCount; i++) for (int i = 0; i < GameObject.Find("Sportifs").transform.childCount; i++)
{ {
_listRunners.Add(GameObject.Find("Sportifs").transform.GetChild(i).gameObject); _listRunners.Add(GameObject.Find("Sportifs").transform.GetChild(i).gameObject);
moyenneMotivation += _listRunners[i].GetComponent<Runners>().motivation; moyenneMotivation += _listRunners[i].GetComponent<Runners>().motivation;
...@@ -59,18 +68,25 @@ ...@@ -59,18 +68,25 @@
Ui.motiv = 100; Ui.motiv = 100;
} }
} }
else
{
}
} }
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
public System.Random getRandom() public System.Random getRandom()
{ {
return rdn; return rdn;
} }
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
public static RunnersFactory getInstance() public static RunnersFactory getInstance()
{ {
return instance; return instance;
} }
} }
} }
\ No newline at end of file
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4bd06838c6bae9e4c851fdf644725c43 guid: 83c92beabb7b86a4c918cc4556b2e513
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: a7285e8f584ddd243b3351cb522b3b2e guid: fa99c0f97eade234eab2a35695f083d2
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: 52b8bf46189c1df4b8cf3ad8b5c919cb guid: 0769b8875758a4f4ca967971659317da
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: ee1ab971b5d74e047901e5f185470c06 guid: 70a24ccac175e014a98fc79f9ab7b6fc
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: 59c69f6cd73b6234d8a16a515649cd32 guid: e886650e748043842b8b5b204bf6f2ae
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: 58f637f77258f2d45aced42fe5d4425d guid: aab15d0f62ec5e84a8daf5dec909a032
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
...@@ -6,24 +6,21 @@ ...@@ -6,24 +6,21 @@
using Mapbox.Unity.Utilities; using Mapbox.Unity.Utilities;
using System.Collections.Generic; using System.Collections.Generic;
//! @authors Wakestufou
//! @brief "Insérer description rapide"
//! @details "Insérer description détaillée"
public class WaypointSpawner : MonoBehaviour public class WaypointSpawner : MonoBehaviour
{ {
[SerializeField] // Champs privés
AbstractMap _map; Vector2d[] _locations; //<! "Insérer description de la variable"
List<GameObject> _spawnedObjects; //<! "Insérer description de la variable"
[SerializeField] [SerializeField] AbstractMap _map; //<! "Insérer description de la variable"
[Geocode] [SerializeField] [Geocode] string[] _locationStrings;
string[] _locationStrings; [SerializeField] float _spawnScale = 100f; //<! "Insérer description de la variable"
Vector2d[] _locations; [SerializeField] GameObject _markerPrefab; //<! "Insérer description de la variable"
[SerializeField]
float _spawnScale = 100f;
[SerializeField]
GameObject _markerPrefab;
List<GameObject> _spawnedObjects;
//! @brief Se lance au lancement du script.
//! @details "Insérer description détaillée"
void Start() void Start()
{ {
_locations = new Vector2d[_locationStrings.Length]; _locations = new Vector2d[_locationStrings.Length];
...@@ -39,6 +36,8 @@ ...@@ -39,6 +36,8 @@
} }
} }
//! @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()
{ {
int count = _spawnedObjects.Count; int count = _spawnedObjects.Count;
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1734165602365419288
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1734165602365419271}
- component: {fileID: 1734165602365419269}
- component: {fileID: 1734165602365419270}
- component: {fileID: 1734165602365419267}
- component: {fileID: 1734165602365419268}
m_Layer: 5
m_Name: startText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1734165602365419271
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1734165602365419288}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.0490679, y: 1.0490679, z: 1.0490679}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
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: -3.5525208, y: -71.86951}
m_SizeDelta: {x: 981, y: 140}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1734165602365419269
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1734165602365419288}
m_CullTransparentMesh: 0
--- !u!114 &1734165602365419270
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1734165602365419288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: "Placez un point de d\xE9part."
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 72
m_fontSizeBase: 72
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_VertexBufferAutoSizeReduction: 1
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: NaN, y: NaN, z: NaN, w: NaN}
m_textInfo:
textComponent: {fileID: 1734165602365419270}
characterCount: 26
spriteCount: 0
spaceCount: 4
wordCount: 5
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!223 &1734165602365419267
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1734165602365419288}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &1734165602365419268
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1734165602365419288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
fileFormatVersion: 2
guid: 6576850915512b447ac138a1833c2783
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
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