Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
AIGT_ProceduralTerrain
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
Releases
Model registry
Operate
Environments
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
Buenen,F.W.M. (Felix)
AIGT_ProceduralTerrain
Commits
0c3789bc
Commit
0c3789bc
authored
4 years ago
by
Julian Thijssen
Browse files
Options
Downloads
Patches
Plain Diff
Shorten GetNextBorderPoint code
parent
70a9adb1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/CoastlineGenerator.cs
+14
-46
14 additions, 46 deletions
Assets/Scripts/CoastlineGenerator.cs
with
14 additions
and
46 deletions
Assets/Scripts/CoastlineGenerator.cs
+
14
−
46
View file @
0c3789bc
...
...
@@ -351,54 +351,22 @@ public class CoastlineGenerator : MonoBehaviour
private
Vector2
GetNextBorderPoint
(
Vector2
pos
,
List
<
Vector2
>
newOrderedBorderPoints
)
{
// check n-w-s-e
Vector2
north
=
pos
+
new
Vector2
(
0
,
1
);
if
(
CheckIsNextOnBorder
(
north
,
newOrderedBorderPoints
))
Vector2
[]
neighbourhood
=
{
return
north
;
}
Vector2
west
=
pos
+
new
Vector2
(-
1
,
0
);
if
(
CheckIsNextOnBorder
(
west
,
newOrderedBorderPoints
))
{
return
west
;
}
Vector2
south
=
pos
+
new
Vector2
(
0
,
-
1
);
if
(
CheckIsNextOnBorder
(
south
,
newOrderedBorderPoints
))
{
return
south
;
}
Vector2
east
=
pos
+
new
Vector2
(
1
,
0
);
if
(
CheckIsNextOnBorder
(
east
,
newOrderedBorderPoints
))
{
return
east
;
}
// check diagonals
Vector2
northwest
=
pos
+
new
Vector2
(-
1
,
1
);
if
(
CheckIsNextOnBorder
(
northwest
,
newOrderedBorderPoints
))
{
return
northwest
;
}
Vector2
southwest
=
pos
+
new
Vector2
(-
1
,
-
1
);
if
(
CheckIsNextOnBorder
(
southwest
,
newOrderedBorderPoints
))
{
return
southwest
;
}
Vector2
southeast
=
pos
+
new
Vector2
(
1
,
-
1
);
if
(
CheckIsNextOnBorder
(
southeast
,
newOrderedBorderPoints
))
{
return
southeast
;
}
Vector2
northeast
=
pos
+
new
Vector2
(
1
,
1
);
if
(
CheckIsNextOnBorder
(
northeast
,
newOrderedBorderPoints
))
new
Vector2
(
0
,
1
),
new
Vector2
(-
1
,
0
),
new
Vector2
(
0
,
-
1
),
new
Vector2
(
1
,
0
),
new
Vector2
(-
1
,
1
),
new
Vector2
(-
1
,
-
1
),
new
Vector2
(
1
,
-
1
),
new
Vector2
(
1
,
1
)
};
foreach
(
Vector2
dir
in
neighbourhood
)
{
return
northeast
;
if
(
CheckIsNextOnBorder
(
pos
+
dir
,
newOrderedBorderPoints
))
return
pos
+
dir
;
}
return
new
Vector2
(-
1
,
-
1
);
...
...
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