Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
four
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
gadig
four
Commits
17ee1245
Commit
17ee1245
authored
Nov 19, 2016
by
Luke Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed map tool to use prefabs
parent
d0e3b581
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
Assets/Scripts/MapTool/MapLoader.cs
Assets/Scripts/MapTool/MapLoader.cs
+10
-6
No files found.
Assets/Scripts/MapTool/MapLoader.cs
View file @
17ee1245
...
...
@@ -19,7 +19,10 @@ public class MapLoader : MonoBehaviour {
int
x
=
int
.
Parse
(
coords
[
0
].
ToString
());
int
y
=
int
.
Parse
(
coords
[
1
].
ToString
());
Tile
[,]
map
=
GenerateTiles
(
x
,
y
);
Tile
[,]
map
=
new
Tile
[
y
,
x
];
float
startx
;
float
starty
;
for
(
int
i
=
1
;
i
<
lines
.
Length
-
1
;
i
++)
{
...
...
@@ -29,14 +32,15 @@ public class MapLoader : MonoBehaviour {
y
=
int
.
Parse
(
args
[
1
]);
map
[
x
,
y
].
walkable
=
bool
.
Parse
(
args
[
2
]);
map
[
x
,
y
].
weight
=
float
.
Parse
(
args
[
3
]);
if
(
map
[
x
,
y
].
walkable
){
Destroy
(
map
[
x
,
y
].
GetComponent
<
BoxCollider2D
>
());
}
map
[
x
,
y
]
=
((
GameObject
)
Instantiate
(
Resources
.
Load
<
GameObject
>
(
"Prefabs/"
+
args
[
4
]))).
GetComponent
<
Tile
>
();
map
[
x
,
y
].
weight
=
float
.
Parse
(
args
[
3
]);
startx
=
(
float
)
x
-
(
float
)
map
.
GetLength
(
0
)
/
2f
;
starty
=
(
float
)
y
-
(
float
)
map
.
GetLength
(
1
)
/
2f
;
map
[
x
,
y
].
transform
.
position
=
new
Vector3
(
startx
,
starty
,
0
);
map
[
x
,
y
].
GetComponent
<
SpriteRenderer
>
().
sprite
=
Resources
.
Load
<
Sprite
>
(
"Tiles/"
+
args
[
4
]);
}
Map
.
map
=
map
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment