Distance in HUD and fix singleton
This commit is contained in:
parent
16f24645fc
commit
29f4972982
@ -532,7 +532,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 867919272}
|
m_GameObject: {fileID: 867919272}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 0.5, y: 0.5, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 958716516}
|
- {fileID: 958716516}
|
||||||
m_Father: {fileID: 896084742}
|
m_Father: {fileID: 896084742}
|
||||||
@ -572,8 +572,8 @@ SpriteRenderer:
|
|||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_Sprite: {fileID: 21300000, guid: 625ba441da94bca4ea540d5546c88a1f, type: 3}
|
m_Sprite: {fileID: 21300000, guid: ff874d8acc5af46fb9cd88466b65e0af, type: 3}
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 0, b: 0, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
m_DrawMode: 0
|
m_DrawMode: 0
|
||||||
@ -646,7 +646,7 @@ GameObject:
|
|||||||
- component: {fileID: 958716518}
|
- component: {fileID: 958716518}
|
||||||
- component: {fileID: 958716517}
|
- component: {fileID: 958716517}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Display
|
m_Name: Distance
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@ -668,8 +668,8 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 0, y: 2.33}
|
m_AnchoredPosition: {x: 0, y: 0.65}
|
||||||
m_SizeDelta: {x: 190.44, y: 91.2}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &958716517
|
--- !u!114 &958716517
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -693,16 +693,16 @@ MonoBehaviour:
|
|||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_FontData:
|
m_FontData:
|
||||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
m_FontSize: 75
|
m_FontSize: 30
|
||||||
m_FontStyle: 0
|
m_FontStyle: 0
|
||||||
m_BestFit: 0
|
m_BestFit: 0
|
||||||
m_MinSize: 1
|
m_MinSize: 1
|
||||||
m_MaxSize: 300
|
m_MaxSize: 300
|
||||||
m_Alignment: 0
|
m_Alignment: 4
|
||||||
m_AlignByGeometry: 0
|
m_AlignByGeometry: 0
|
||||||
m_RichText: 1
|
m_RichText: 1
|
||||||
m_HorizontalOverflow: 0
|
m_HorizontalOverflow: 1
|
||||||
m_VerticalOverflow: 0
|
m_VerticalOverflow: 1
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
m_Text: '400m '
|
m_Text: '400m '
|
||||||
--- !u!222 &958716518
|
--- !u!222 &958716518
|
||||||
@ -918,6 +918,9 @@ MonoBehaviour:
|
|||||||
progressions:
|
progressions:
|
||||||
- {fileID: 896084743}
|
- {fileID: 896084743}
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
|
distances:
|
||||||
|
- {fileID: 958716517}
|
||||||
|
- {fileID: 0}
|
||||||
maxSpeedsValues:
|
maxSpeedsValues:
|
||||||
- 0
|
- 0
|
||||||
- 0
|
- 0
|
||||||
@ -1041,7 +1044,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 1259524805}
|
m_GameObject: {fileID: 1259524805}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 15.33, y: 0, z: 0}
|
m_LocalPosition: {x: 15.33, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 10, y: 10, z: 1}
|
m_LocalScale: {x: 5, y: 5, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 896084742}
|
m_Father: {fileID: 896084742}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
@ -1114,7 +1117,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 1394735950}
|
m_GameObject: {fileID: 1394735950}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 10, y: 10, z: 0}
|
m_LocalScale: {x: 5, y: 5, z: 0}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 896084742}
|
m_Father: {fileID: 896084742}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
|
|||||||
@ -35,12 +35,13 @@ public class BikeManager : MonoBehaviour {
|
|||||||
private GameManager gm;
|
private GameManager gm;
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
gm = GameManager.Instance;
|
|
||||||
gm.RegisterBike(this, playerID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
|
gm = GameManager.Instance;
|
||||||
|
gm.RegisterBike(this, playerID);
|
||||||
|
|
||||||
vm = gameObject.GetComponent<VideoManager>();
|
vm = gameObject.GetComponent<VideoManager>();
|
||||||
|
|
||||||
// TODO: Refactor w a player manager ?
|
// TODO: Refactor w a player manager ?
|
||||||
@ -129,4 +130,8 @@ public class BikeManager : MonoBehaviour {
|
|||||||
public float GetProgress() {
|
public float GetProgress() {
|
||||||
return distanceRun / distanceToRun;
|
return distanceRun / distanceToRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float GetDistance() {
|
||||||
|
return distanceRun;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public class GameManager : MonoBehaviour {
|
|||||||
private void Awake(){
|
private void Awake(){
|
||||||
if (_instance != null && _instance != this) {
|
if (_instance != null && _instance != this) {
|
||||||
Debug.Log("WARNING: Other instance of GameManager found.");
|
Debug.Log("WARNING: Other instance of GameManager found.");
|
||||||
Destroy(this.gameObject);
|
Destroy(gameObject);
|
||||||
} else {
|
} else {
|
||||||
_instance = this;
|
_instance = this;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,18 +8,19 @@ public class HUDManager : MonoBehaviour {
|
|||||||
public Text[] tachometers;
|
public Text[] tachometers;
|
||||||
public Text[] maxSpeeds;
|
public Text[] maxSpeeds;
|
||||||
public HUDProgress[] progressions;
|
public HUDProgress[] progressions;
|
||||||
|
public Text[] distances;
|
||||||
|
|
||||||
public float[] maxSpeedsValues = new float[2];
|
public float[] maxSpeedsValues = new float[2];
|
||||||
|
|
||||||
GameManager gm;
|
GameManager gm;
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
gm = GameManager.Instance;
|
|
||||||
gm.RegisterHUD(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
|
gm = GameManager.Instance;
|
||||||
|
gm.RegisterHUD(this);
|
||||||
gm.Hello();
|
gm.Hello();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,8 +28,13 @@ public class HUDManager : MonoBehaviour {
|
|||||||
void Update () {
|
void Update () {
|
||||||
UpdateSpeeds(0);
|
UpdateSpeeds(0);
|
||||||
UpdateProgress(0);
|
UpdateProgress(0);
|
||||||
|
UpdateDistance(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateDistance(int bikeID) {
|
||||||
|
distances[bikeID].text = gm.GetBikeManager(bikeID).GetDistance().ToString("#0") + "m";
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateProgress(int bikeID) {
|
void UpdateProgress(int bikeID) {
|
||||||
progressions[bikeID].SetProgress(gm.GetBikeManager(bikeID).GetProgress());
|
progressions[bikeID].SetProgress(gm.GetBikeManager(bikeID).GetProgress());
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Assets/Sprites/bicycle.png
Normal file
BIN
Assets/Sprites/bicycle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
77
Assets/Sprites/bicycle.png.meta
Normal file
77
Assets/Sprites/bicycle.png.meta
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ff874d8acc5af46fb9cd88466b65e0af
|
||||||
|
timeCreated: 1520802188
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
Reference in New Issue
Block a user