Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dyingIsMainstream
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gamejam-gpn15
dyingIsMainstream
Commits
e2ec477c
Commit
e2ec477c
authored
Jun 05, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
turrets are now loaded correctly from xml files.
parent
e6b65d75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
DeserializedLevelsLoader.cs
Assets/Scripts/LevelManagement/DeserializedLevelsLoader.cs
+5
-3
No files found.
Assets/Scripts/LevelManagement/DeserializedLevelsLoader.cs
View file @
e2ec477c
...
...
@@ -122,6 +122,7 @@ public class DeserializedLevelsLoader
item
.
children
[
k
].
rot
=
toFloatZeroIfNull
(
child
.
rot
);
item
.
children
[
k
].
scalex
=
toFloatOneIfNull
(
child
.
scalex
);
item
.
children
[
k
].
scaley
=
toFloatOneIfNull
(
child
.
scaley
);
k
++;
}
sceneItemsList
.
Add
(
item
);
...
...
@@ -133,7 +134,6 @@ public class DeserializedLevelsLoader
// TODO load height coordinate from a directory
GameObject
newGameObject
=
MonoBehaviour
.
Instantiate
(
item
.
prefab
)
as
GameObject
;
// set position
setPos2D
(
newGameObject
,
new
Vector2
(
item
.
x
,
item
.
y
));
...
...
@@ -144,18 +144,20 @@ public class DeserializedLevelsLoader
foreach
(
Transform
t
in
newGameObject
.
GetComponentsInChildren
<
Transform
>())
{
if
(
!(
t
.
parent
==
null
)
&&
(
t
.
parent
.
name
.
Equals
(
item
.
prefab
)
))
if
(
(!(
t
.
parent
==
null
))
&&
(
t
.
parent
==
newGameObject
.
transform
))
{
bool
found
=
false
;
foreach
(
ItemChildStruct
child
in
item
.
children
)
//Ja das ist wahrscheinlich Laufzeitmig nicht ideal, aber die Arrays haben eh nur eine Hand viele Elemente
{
if
(
t
.
name
==
child
.
name
)
{
Debug
.
Log
(
"Set child "
+
child
.
name
)
;
found
=
true
;
setPos2D
(
t
.
gameObject
,
new
Vector2
(
child
.
x
,
child
.
y
));
setRot2D
(
t
.
gameObject
,
child
.
rot
);
setScale2D
(
t
.
gameObject
,
child
.
scalex
,
child
.
scaley
);
}
}
if
(!
found
)
Debug
.
LogWarning
(
"No matching xml element found for "
+
t
.
name
);
}
}
// set parent
...
...
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