Préparation liée au HUD

This commit is contained in:
Florent Guiotte 2018-03-06 17:37:41 +01:00
parent 8d556377b2
commit a8954747bd
4 changed files with 103 additions and 91 deletions

View File

@ -194,6 +194,50 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &896084741
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 896084742}
- component: {fileID: 896084743}
m_Layer: 0
m_Name: HUD Progress
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &896084742
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 896084741}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.4, y: -0.4, z: -1.11}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1865218697}
m_Father: {fileID: 1036252279}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &896084743
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 896084741}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bd8663f20dbcc4acf9331c7fe29b69c3, type: 3}
m_Name:
m_EditorClassIdentifier:
start: {fileID: 896084741}
end: {fileID: 1865218696}
bikeManager: {fileID: 1036252281}
--- !u!1 &1036252277
GameObject:
m_ObjectHideFlags: 0
@ -203,10 +247,10 @@ GameObject:
m_Component:
- component: {fileID: 1036252279}
- component: {fileID: 1036252278}
- component: {fileID: 1036252280}
- component: {fileID: 1036252281}
- component: {fileID: 1036252280}
m_Layer: 0
m_Name: Square
m_Name: ScreenP1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -265,7 +309,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 8.888889, y: 0, z: 0}
m_LocalScale: {x: 17.777779, y: 10, z: 1}
m_Children: []
m_Children:
- {fileID: 896084742}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -296,108 +341,31 @@ MonoBehaviour:
wheelDiameter: 0.559
ticPerTurn: 4
speedIntegrationTime: 1
--- !u!1 &2032723387
--- !u!1 &1865218696
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2032723390}
- component: {fileID: 2032723389}
- component: {fileID: 2032723388}
- component: {fileID: 1865218697}
m_Layer: 0
m_Name: Square (2)
m_Name: END
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!328 &2032723388
VideoPlayer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2032723387}
m_Enabled: 1
m_VideoClip: {fileID: 0}
m_TargetCameraAlpha: 1
m_TargetCamera3DLayout: 0
m_TargetCamera: {fileID: 0}
m_TargetTexture: {fileID: 0}
m_TimeReference: 0
m_TargetMaterialRenderer: {fileID: 0}
m_TargetMaterialProperty: _MainTex
m_RenderMode: 3
m_AspectRatio: 2
m_DataSource: 0
m_PlaybackSpeed: 1
m_AudioOutputMode: 1
m_TargetAudioSources: []
m_DirectAudioVolumes: []
m_Url:
m_EnabledAudioTracks:
m_DirectAudioMutes:
m_ControlledAudioTrackCount: 0
m_PlayOnAwake: 1
m_SkipOnDrop: 1
m_Looping: 0
m_WaitForFirstFrame: 1
m_FrameReadyEventEnabled: 0
--- !u!212 &2032723389
SpriteRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2032723387}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 5409794c08b164f178fedef6756b97d3, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
--- !u!4 &2032723390
m_IsActive: 1
--- !u!4 &1865218697
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2032723387}
m_GameObject: {fileID: 1865218696}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -4.444445, y: 0, z: 0}
m_LocalScale: {x: 8.888889, y: 10, z: 1}
m_LocalPosition: {x: 1, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_Father: {fileID: 896084742}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -79,7 +79,7 @@ public class BikeManager : MonoBehaviour {
//Debug.Log(GetProgress());
}
float GetProgress() {
public float GetProgress() {
return distanceRun / distanceToRun;
}
}

View File

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HUDProgress : MonoBehaviour {
public GameObject start;
public GameObject end;
public BikeManager bikeManager;
private Transform tstart;
private Transform tend;
private GameObject progress;
// Use this for initialization
void Start () {
tstart = start.GetComponent<Transform>();
tend = end.GetComponent<Transform>();
progress = new GameObject("Progress");
progress.transform.parent = tstart;
progress.transform.localPosition = new Vector3(0, 0, 0);
}
// Update is called once per frame
void Update () {
float p = bikeManager.GetProgress();
progress.transform.position = tstart.position * (1 - p) + tend.position * p;
}
}

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: bd8663f20dbcc4acf9331c7fe29b69c3
timeCreated: 1520340800
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: