Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Projet Unity S4 IUT Orsay
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sofiane Lasri
Projet Unity S4 IUT Orsay
Commits
bb07314c
Commit
bb07314c
authored
3 years ago
by
Clem
Browse files
Options
Downloads
Patches
Plain Diff
bla bla bla
parent
8f2b48b9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/CourseAPieds/V7.cs
+16
-24
16 additions, 24 deletions
Assets/Scripts/CourseAPieds/V7.cs
with
16 additions
and
24 deletions
Assets/Scripts/CourseAPieds/V7.cs
+
16
−
24
View file @
bb07314c
/*
Clément Géraudie
/**
* Fichier : V7.cs
*
* Auteur : Clément GERAUDIE
* Date : Avril 2022
* Groupe : TP 4C
*
* Résumé du fichier :
*
* Cette classe permet de générer un terrain aléatoire et d'y ajouter un chemin aléatoire.
*
*/
using
UnityEngine
;
public
class
V7
:
MonoBehaviour
...
...
@@ -166,8 +177,6 @@ public class V7 : MonoBehaviour
// On va calculer la hauteur du point par rapport aux coordonées d'avant, et d'après
if
(
x
+
indexLargeur
-
1
<
0
||
y
+
indexLargeur
-
1
<
0
){
hauteurAvant
=
0
;
}
else
{
hauteurAvant
=
terrain
.
terrainData
.
GetHeight
(
x
+
indexLargeur
-
1
,
y
+
indexLargeur
-
1
);
...
...
@@ -196,7 +205,8 @@ public class V7 : MonoBehaviour
Debug
.
Log
(
"hauteur = "
+
hauteur
);
terrain
.
terrainData
.
SetHeights
(
x
+
indexLargeur
,
y
+
indexLargeur
,
new
float
[,]
{
{
hauteur
,
hauteur
}});
if
(
indexLargeur
==
3
)
int
obstacle
=
Random
.
Range
(
0
,
largeurDuChemin
);
if
(
indexLargeur
==
obstacle
)
{
cmptCubes
++;
if
(
cmptCubes
==
5
)
...
...
@@ -213,24 +223,6 @@ public class V7 : MonoBehaviour
}
}
void
OnDrawGizmosSelected
()
{
if
(
debugMode
){
// On définie les paramètres de la gizmo sphere
Gizmos
.
color
=
Color
.
red
;
if
(
pointsDuChemin
!=
null
)
{
float
xPositionMultiplier
=
terrain
.
terrainData
.
size
.
x
/
heightmapWidth
;
float
yPositionMultiplier
=
terrain
.
terrainData
.
size
.
z
/
heightmapHeight
;
// On va tracer une gizmo sphere sur chaque point du chemin
for
(
int
i
=
0
;
i
<
nombreDePointsAGenerer
;
i
++)
{
Gizmos
.
DrawSphere
(
new
Vector3
(
pointsDuChemin
[
0
,
i
]
*
xPositionMultiplier
,
0
,
pointsDuChemin
[
1
,
i
]
*
yPositionMultiplier
),
largeurDuChemin
);
}
}
}
}
float
[,]
GenerateHeights
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment