Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CityGen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kent Holt
CityGen
Commits
66b5bb5a
Commit
66b5bb5a
authored
6 years ago
by
Eldar Hauge Torkelsen
Browse files
Options
Downloads
Patches
Plain Diff
Fixed nullreference in genDemo
parent
6ef11386
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Assets/Scripts/CityGen/CityGen.cs
+21
-9
21 additions, 9 deletions
Assets/Scripts/CityGen/CityGen.cs
with
21 additions
and
9 deletions
Assets/Scripts/CityGen/CityGen.cs
+
21
−
9
View file @
66b5bb5a
...
@@ -33,6 +33,7 @@ public class CityGen : MonoBehaviour {
...
@@ -33,6 +33,7 @@ public class CityGen : MonoBehaviour {
//TODO:add prefabs
//TODO:add prefabs
this
.
pins
=
new
Pin
[
1
];
this
.
pins
=
new
Pin
[
1
];
this
.
pins
[
0
]
=
new
Pin
();
this
.
pins
[
0
].
genDemo
(
id
);
this
.
pins
[
0
].
genDemo
(
id
);
}
}
}
}
...
@@ -48,11 +49,11 @@ public class CityGen : MonoBehaviour {
...
@@ -48,11 +49,11 @@ public class CityGen : MonoBehaviour {
[
System
.
Serializable
]
[
System
.
Serializable
]
public
class
Tile
{
public
class
Tile
{
public
int
height
;
public
int
height
;
public
Transform
transform
;
public
Vector3
orientation
;
public
void
genDemo
(
int
id
){
public
void
genDemo
(
int
id
){
this
.
height
=
4
+
id
;
this
.
height
=
4
+
id
;
this
.
transform
.
ro
tation
=
new
Quaternion
(
1.0f
,
0.0f
,
0.0f
,
1
);
this
.
orien
tation
=
new
Vector3
(
1.0f
,
0.0f
,
0.0f
);
}
}
}
}
...
@@ -62,7 +63,7 @@ public class CityGen : MonoBehaviour {
...
@@ -62,7 +63,7 @@ public class CityGen : MonoBehaviour {
public
Prefab
[]
prefabs
;
public
Prefab
[]
prefabs
;
public
Vector2
layoutDimension
;
public
Vector2
layoutDimension
;
[
HideInInspector
]
[
HideInInspector
]
public
int
[
][
]
layout
;
public
int
[
,
]
layout
;
public
Tile
[]
tiles
;
public
Tile
[]
tiles
;
/*
/*
...
@@ -73,8 +74,9 @@ public class CityGen : MonoBehaviour {
...
@@ -73,8 +74,9 @@ public class CityGen : MonoBehaviour {
public
void
genDemo
(){
public
void
genDemo
(){
this
.
zoneTypes
=
new
ZoneType
[
3
];
this
.
zoneTypes
=
new
ZoneType
[
3
];
for
(
int
i
=
0
;
i
<
this
.
zoneTypes
.
Length
;
i
++)
{
for
(
int
i
=
0
;
i
<
zoneTypes
.
Length
;
i
++){
zoneTypes
[
i
]
=
new
ZoneType
();
zoneTypes
[
i
].
genDemo
(
i
);
zoneTypes
[
i
].
genDemo
(
i
);
}
}
...
@@ -83,14 +85,24 @@ public class CityGen : MonoBehaviour {
...
@@ -83,14 +85,24 @@ public class CityGen : MonoBehaviour {
this
.
layoutDimension
.
x
=
5
;
this
.
layoutDimension
.
x
=
5
;
this
.
layoutDimension
.
y
=
5
;
this
.
layoutDimension
.
y
=
5
;
this
.
layout
[
2
][
2
]
=
1
;
this
.
layout
=
new
int
[(
int
)
this
.
layoutDimension
.
x
,(
int
)
this
.
layoutDimension
.
y
];
this
.
layout
[
2
][
3
]
=
-
1
;
this
.
layout
[
2
,
2
]
=
1
;
this
.
layout
[
3
][
2
]
=
-
1
;
this
.
layout
[
2
,
3
]
=
-
1
;
this
.
layout
[
3
][
3
]
=
-
1
;
this
.
layout
[
3
,
2
]
=
-
1
;
this
.
layout
[
3
,
3
]
=
-
1
;
this
.
tiles
=
new
Tile
[
25
];
this
.
tiles
[
6
]
=
new
Tile
();
this
.
tiles
[
6
].
genDemo
(
1
);
this
.
tiles
[
6
].
genDemo
(
1
);
this
.
tiles
[
7
]
=
new
Tile
();
this
.
tiles
[
7
].
genDemo
(-
1
);
this
.
tiles
[
7
].
genDemo
(-
1
);
this
.
tiles
[
11
]
=
new
Tile
();
this
.
tiles
[
11
].
genDemo
(-
1
);
this
.
tiles
[
11
].
genDemo
(-
1
);
this
.
tiles
[
12
]
=
new
Tile
();
this
.
tiles
[
12
].
genDemo
(-
1
);
this
.
tiles
[
12
].
genDemo
(-
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