Skip to content
Snippets Groups Projects
Commit 8f2b48b9 authored by raffytaro's avatar raffytaro
Browse files

Merge branch 'Course-à-pieds' of...

Merge branch 'Course-à-pieds' of https://git.iut-orsay.fr/projets-s4-2022/projet-unity into Course-à-pieds
parents 51946695 e08e62da
Branches
No related tags found
No related merge requests found
fileFormatVersion: 2
guid: c72c868a564ccf34490890be8c2318b7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6269116704956453700
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: CubeMaterial
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.52677006, g: 0.8962264, b: 0.029592399, a: 1}
- _Color: {r: 0.52677006, g: 0.8962264, b: 0.029592399, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
fileFormatVersion: 2
guid: 22d7a8a62c660b6418bd5ab05fb4e7a9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Skybox_Daytime
m_Shader: {fileID: 103, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 1000
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Tex:
m_Texture: {fileID: 8900000, guid: 1cde0e200e792cb4491204276a656490, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Exposure: 1
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Rotation: 0
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
m_BuildTextureStacks: []
fileFormatVersion: 2
guid: f1fa610c828aefe4089e2aa49bae33e8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
...@@ -26,7 +26,7 @@ RenderSettings: ...@@ -26,7 +26,7 @@ RenderSettings:
m_AmbientIntensity: 1 m_AmbientIntensity: 1
m_AmbientMode: 0 m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} m_SkyboxMaterial: {fileID: 2100000, guid: f1fa610c828aefe4089e2aa49bae33e8, type: 2}
m_HaloStrength: 0.5 m_HaloStrength: 0.5
m_FlareStrength: 1 m_FlareStrength: 1
m_FlareFadeSpeed: 3 m_FlareFadeSpeed: 3
...@@ -38,7 +38,7 @@ RenderSettings: ...@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994} m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} m_IndirectSpecularColor: {r: 0.7302244, g: 0.7889752, b: 0.8498586, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
...@@ -226,6 +226,121 @@ MonoBehaviour: ...@@ -226,6 +226,121 @@ MonoBehaviour:
terrainHeight: 256 terrainHeight: 256
scale: 2 scale: 2
ptProches: ptProches:
Cube: {fileID: 541354705}
--- !u!1 &541354704
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 541354709}
- component: {fileID: 541354708}
- component: {fileID: 541354707}
- component: {fileID: 541354706}
- component: {fileID: 541354705}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!54 &541354705
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 541354704}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &541354706
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 541354704}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &541354707
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 541354704}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 22d7a8a62c660b6418bd5ab05fb4e7a9, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &541354708
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 541354704}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &541354709
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 541354704}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 10, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993 --- !u!1 &705507993
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -30,13 +30,15 @@ public class V7 : MonoBehaviour ...@@ -30,13 +30,15 @@ public class V7 : MonoBehaviour
public int[] ptProches; public int[] ptProches;
int ptsChemAbscisse; int ptsChemAbscisse;
int ptsChemIndex; int ptsChemIndex;
public Rigidbody Cube;
int cmptCubes = 0;
//public float offsetX = 100f; //public float offsetX = 100f;
//public float offsetY = 100f; //public float offsetY = 100f;
void Start() void Start()
{ {
// Création du tableau des points aléatoires (chemin) // Création du tableau des points aléatoires (chemin)
pointsDuChemin = new int[2, nombreDePointsAGenerer]; pointsDuChemin = new int[2, nombreDePointsAGenerer];
// Récupère les dimensions du tableau de manière optimisée // Récupère les dimensions du tableau de manière optimisée
...@@ -144,6 +146,8 @@ public class V7 : MonoBehaviour ...@@ -144,6 +146,8 @@ public class V7 : MonoBehaviour
{ {
int x = x1; int x = x1;
int y = y1; int y = y1;
float xPositionMultiplier = terrain.terrainData.size.x / heightmapWidth;
float yPositionMultiplier = terrain.terrainData.size.z / heightmapHeight;
// On va faire un lerp entre les points // On va faire un lerp entre les points
float lerp = 0f; float lerp = 0f;
while(lerp < 1f) while(lerp < 1f)
...@@ -155,20 +159,25 @@ public class V7 : MonoBehaviour ...@@ -155,20 +159,25 @@ public class V7 : MonoBehaviour
float hauteur, hauteurAvant, hauteurApres; float hauteur, hauteurAvant, hauteurApres;
// On va tracer le chemin en largeur // On va tracer le chemin en largeur
for(int i=0; i<largeurDuChemin; i++) for(int indexLargeur=0; indexLargeur<largeurDuChemin; indexLargeur++)
{ {
if(x+i < heightmapWidth && y+i < heightmapHeight) if(x+indexLargeur < heightmapWidth && y+indexLargeur < heightmapHeight)
{ {
// On va calculer la hauteur du point par rapport aux coordonées d'avant, et d'après // On va calculer la hauteur du point par rapport aux coordonées d'avant, et d'après
if(x+i-1 < 0 || y+i-1 < 0){ if(x+indexLargeur-1 < 0 || y+indexLargeur-1 < 0){
hauteurAvant = 0; hauteurAvant = 0;
}else{
hauteurAvant = terrain.terrainData.GetHeight(x+i-1, y+i-1);
}
else{
hauteurAvant = terrain.terrainData.GetHeight(x+indexLargeur-1, y+indexLargeur-1);
} }
if(x+i+1 >= heightmapWidth || y+i+1 >= heightmapHeight){ if(x+indexLargeur+1 >= heightmapWidth || y+indexLargeur+1 >= heightmapHeight){
hauteurApres = 0; hauteurApres = 0;
}else{ }
hauteurApres = terrain.terrainData.GetHeight(x+i+1, y+i+1); else
{
hauteurApres = terrain.terrainData.GetHeight(x+indexLargeur+1, y+indexLargeur+1);
} }
// On va faire la moyenne des deux hauteurs si elles sont != 0 // On va faire la moyenne des deux hauteurs si elles sont != 0
if(hauteurAvant != 0 && hauteurApres != 0){ if(hauteurAvant != 0 && hauteurApres != 0){
...@@ -186,7 +195,19 @@ public class V7 : MonoBehaviour ...@@ -186,7 +195,19 @@ public class V7 : MonoBehaviour
hauteur = hauteur / terrain.terrainData.size.y; hauteur = hauteur / terrain.terrainData.size.y;
Debug.Log("hauteur = " + hauteur); Debug.Log("hauteur = " + hauteur);
terrain.terrainData.SetHeights(x+i, y+i, new float[,] { { hauteur, hauteur }}); terrain.terrainData.SetHeights(x+indexLargeur, y+indexLargeur, new float[,] { { hauteur, hauteur }});
if (indexLargeur == 3)
{
cmptCubes++;
if (cmptCubes == 5)
{
Rigidbody instance;
instance = Instantiate(Cube, new Vector3((x + indexLargeur) * xPositionMultiplier, hauteur * terrain.terrainData.size.y, (y + indexLargeur) * yPositionMultiplier), Quaternion.identity);
instance.GetComponent<Renderer>().material.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
cmptCubes = 0;
}
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment