Intégration finale du GUI
This commit is contained in:
parent
19881ec321
commit
e9420a2b89
File diff suppressed because it is too large
Load Diff
@ -168,6 +168,99 @@ MonoBehaviour:
|
||||
NormalColor: {r: 0.92156863, g: 0.91764706, b: 0.7019608, a: 1}
|
||||
SelectorImage: {fileID: 21300000, guid: 40afa452a1eb10a45b7d9585767a24d8, type: 3}
|
||||
SelectorColor: {r: 0.0992647, g: 0.7941176, b: 0.13280922, a: 1}
|
||||
--- !u!1 &47890329
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 47890334}
|
||||
- component: {fileID: 47890333}
|
||||
- component: {fileID: 47890332}
|
||||
- component: {fileID: 47890331}
|
||||
- component: {fileID: 47890330}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera 2
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &47890330
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 47890329}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 210e21ccb022f402e8103b4340bf8b4f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!81 &47890331
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 47890329}
|
||||
m_Enabled: 0
|
||||
--- !u!124 &47890332
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 47890329}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &47890333
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 47890329}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 1
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &47890334
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 47890329}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &105730543
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2998,7 +3091,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &994377736
|
||||
GameObject:
|
||||
@ -3011,6 +3104,7 @@ GameObject:
|
||||
- component: {fileID: 994377739}
|
||||
- component: {fileID: 994377738}
|
||||
- component: {fileID: 994377737}
|
||||
- component: {fileID: 994377741}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
@ -3081,6 +3175,17 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &994377741
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 994377736}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 210e21ccb022f402e8103b4340bf8b4f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1089339452
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3710,7 +3815,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!114 &1222232373
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3780,7 +3885,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1995066299}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -5438,7 +5543,7 @@ RectTransform:
|
||||
- {fileID: 1467378986}
|
||||
- {fileID: 120214172}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@ -5712,7 +5817,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2039829329
|
||||
GameObject:
|
||||
|
||||
@ -10,11 +10,15 @@ public class HUDManager : MonoBehaviour {
|
||||
public GameObject[] highScores;
|
||||
public Text[] chronos;
|
||||
public Text[] firsts;
|
||||
public Text[] tachometers;
|
||||
public Text[] maxSpeeds;
|
||||
public Text[] tachometersP1;
|
||||
public Text[] tachometersP2;
|
||||
public Text[] maxSpeedsP1;
|
||||
public Text[] maxSpeedsP2;
|
||||
//public HUDProgress[] progressions;
|
||||
public Transform[] progressions;
|
||||
public Text[] distances;
|
||||
public Transform[] progressionsP1;
|
||||
public Transform[] progressionsP2;
|
||||
public Text[] distancesP1;
|
||||
public Text[] distancesP2;
|
||||
[SerializeField]
|
||||
private GameObject[] _messages;
|
||||
public GameObject[] Messages {get {return _messages;} }
|
||||
@ -28,6 +32,9 @@ public class HUDManager : MonoBehaviour {
|
||||
void Awake() {
|
||||
gm = GameManager.Instance;
|
||||
gm.RegisterHUD(this);
|
||||
|
||||
//for (int i = 0; i < totalDistances.Length; i++)
|
||||
// totalDistances [i] = gm.GetRaceDistance ();
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
@ -36,13 +43,13 @@ public class HUDManager : MonoBehaviour {
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
UpdateSpeeds (i);
|
||||
UpdateProgress (i);
|
||||
UpdateDistance (i);
|
||||
UpdateChrono (i);
|
||||
UpdateFlags (i);
|
||||
}
|
||||
UpdateSpeeds ();
|
||||
UpdateProgress ();
|
||||
UpdateDistance ();
|
||||
UpdateChrono (0);
|
||||
UpdateChrono (1);
|
||||
UpdateFlags (0);
|
||||
UpdateFlags (1);
|
||||
// UpdateFirst (0);
|
||||
}
|
||||
|
||||
@ -65,24 +72,39 @@ public class HUDManager : MonoBehaviour {
|
||||
chronos [bikeID].text = string.Format("{0:D2}:{1:D2}:{2:D2}", timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds / 10);
|
||||
}
|
||||
|
||||
void UpdateDistance(int bikeID) {
|
||||
distances[bikeID].text = gm.GetBikeManager(bikeID).GetDistance().ToString("#0") + "m";
|
||||
void UpdateDistance() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
distancesP1 [i].text = gm.GetBikeManager (0).GetDistance ().ToString ("#0") + "m / " + gm.GetRaceDistance() + "m";
|
||||
distancesP2 [i].text = gm.GetBikeManager (1).GetDistance ().ToString ("#0") + "m / " + gm.GetRaceDistance() + "m";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void UpdateProgress(int bikeID) {
|
||||
//progressions[bikeID].SetProgress(gm.GetBikeManager(bikeID).GetProgress());
|
||||
progressions[bikeID].gameObject.GetComponent<RectTransform>().sizeDelta = new Vector2(gm.GetBikeManager(bikeID).GetProgress() * 600, 5);
|
||||
void UpdateProgress() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
progressionsP1 [i].gameObject.GetComponent<RectTransform> ().sizeDelta = new Vector2 (gm.GetBikeManager (0).GetProgress () * 600, 5);
|
||||
progressionsP2 [i].gameObject.GetComponent<RectTransform> ().sizeDelta = new Vector2 (gm.GetBikeManager (1).GetProgress () * 600, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSpeeds(int bikeID) {
|
||||
float s = gm.GetBikeManager(bikeID).GetSpeed();
|
||||
void UpdateSpeeds() {
|
||||
float s1 = gm.GetBikeManager (0).GetSpeed ();
|
||||
float s2 = gm.GetBikeManager (1).GetSpeed ();
|
||||
|
||||
if (s > maxSpeedsValues[bikeID])
|
||||
maxSpeedsValues[bikeID] = s;
|
||||
if (s1 > maxSpeedsValues [0])
|
||||
maxSpeedsValues [0] = s1;
|
||||
|
||||
tachometers[bikeID].text = (s * 3.6f).ToString("#0.0") + "km/h";
|
||||
maxSpeeds[bikeID].text = "Max : " + (maxSpeedsValues[bikeID] * 3.6f).ToString("#0.0");
|
||||
if (s2 > maxSpeedsValues [1])
|
||||
maxSpeedsValues [1] = s2;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
tachometersP1 [i].text = (s1 * 3.6f).ToString ("#0.0") + "km/h";
|
||||
tachometersP2 [i].text = (s2 * 3.6f).ToString ("#0.0") + "km/h";
|
||||
|
||||
maxSpeedsP1 [i].text = "Max : " + (maxSpeedsValues [0] * 3.6f).ToString ("#0.0");
|
||||
maxSpeedsP2 [i].text = "Max : " + (maxSpeedsValues [1] * 3.6f).ToString ("#0.0");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetMessageActive(bool status, int playerID=2) {
|
||||
|
||||
@ -1 +1 @@
|
||||
{"Items":[{"pseudo":"PRENOM","transport":0,"timeStr":"0:28:20"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Tata","transport":0,"timeStr":"0:30:30"},{"pseudo":"Titi","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"}]}
|
||||
{"Items":[{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Tata","transport":0,"timeStr":"0:30:30"},{"pseudo":"Titi","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"},{"pseudo":"Toto","transport":0,"timeStr":"0:30:30"}]}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user