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
d5824a4c
Commit
d5824a4c
authored
Jun 05, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added scale to xml level editor
parent
8d7d8d47
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
16 deletions
+26
-16
Levels.xml
Assets/Resources/Levels.xml
+2
-3
XmlItemsToExport.xml
Assets/Resources/XmlItemsToExport.xml
+3
-3
DeserializedLevels.cs
Assets/Scripts/LevelManagement/DeserializedLevels.cs
+6
-0
DeserializedLevelsLoader.cs
Assets/Scripts/LevelManagement/DeserializedLevelsLoader.cs
+13
-10
DeserializedLevelsSaver.cs
Assets/Scripts/LevelManagement/DeserializedLevelsSaver.cs
+2
-0
No files found.
Assets/Resources/Levels.xml
View file @
d5824a4c
...
@@ -4,9 +4,8 @@
...
@@ -4,9 +4,8 @@
<Developer
StartLevel=
"0"
/>
<Developer
StartLevel=
"0"
/>
<Level>
<Level>
<Item
prefab=
"Ground"
x=
"3.72"
y=
"-0.81"
/>
<Item
prefab=
"Trap"
x=
"-2.2"
y=
"-0.1"
rot=
"90"
/>
<Item
prefab=
"Trap"
x=
"-1.66"
y=
"-0.57"
rot=
"90"
/>
<Item
prefab=
"ground"
x=
"9.3"
y=
"-0.7"
scalex=
"200"
/>
<Item
prefab=
"Turret"
x=
"5.11"
y=
"4.23"
rot=
"180"
/>
</Level>
</Level>
<Level>
<Level>
<Item
prefab=
"PlayerStartPosition"
x=
"5.11"
y=
"-0.92"
/>
<Item
prefab=
"PlayerStartPosition"
x=
"5.11"
y=
"-0.92"
/>
...
...
Assets/Resources/XmlItemsToExport.xml
View file @
d5824a4c
<?xml version="1.0" encoding="Windows-1252"?>
<?xml version="1.0" encoding="Windows-1252"?>
<Levels
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
>
<Levels
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
>
<Level>
<Level>
<Item
prefab=
"Ground"
x=
"3.72"
y=
"-0.81"
/>
<Item
prefab=
"Trap"
x=
"-2.2"
y=
"-0.1"
rot=
"90"
/>
<Item
prefab=
"Trap"
x=
"-1.66"
y=
"-0.57"
rot=
"90"
/>
<Item
prefab=
"ground"
x=
"9.3"
y=
"-0.7"
scalex=
"200"
/>
<Item
prefab=
"Turret"
x=
"5.11"
y=
"4.23"
rot=
"180"
/>
</Level>
</Level>
</Levels>
</Levels>
\ No newline at end of file
Assets/Scripts/LevelManagement/DeserializedLevels.cs
View file @
d5824a4c
...
@@ -44,6 +44,12 @@ public class DeserializedLevels
...
@@ -44,6 +44,12 @@ public class DeserializedLevels
[
XmlAttribute
(
"rot"
)]
[
XmlAttribute
(
"rot"
)]
public
string
rot
;
public
string
rot
;
[
XmlAttribute
(
"scalex"
)]
public
string
scalex
;
[
XmlAttribute
(
"scaley"
)]
public
string
scaley
;
}
}
}
}
Assets/Scripts/LevelManagement/DeserializedLevelsLoader.cs
View file @
d5824a4c
...
@@ -20,12 +20,8 @@ public class DeserializedLevelsLoader
...
@@ -20,12 +20,8 @@ public class DeserializedLevelsLoader
public
float
x
;
public
float
x
;
public
float
y
;
public
float
y
;
public
float
rot
;
public
float
rot
;
}
public
float
scalex
;
public
float
scaley
;
struct
PlayerStartPositionStruct
{
public
float
x
;
public
float
y
;
}
}
// Cache prefabs in prefabDict
// Cache prefabs in prefabDict
...
@@ -88,6 +84,8 @@ public class DeserializedLevelsLoader
...
@@ -88,6 +84,8 @@ public class DeserializedLevelsLoader
item
.
x
=
toFloatZeroIfNull
(
deserializedItem
.
x
);
item
.
x
=
toFloatZeroIfNull
(
deserializedItem
.
x
);
item
.
y
=
toFloatZeroIfNull
(
deserializedItem
.
y
);
item
.
y
=
toFloatZeroIfNull
(
deserializedItem
.
y
);
item
.
rot
=
toFloatZeroIfNull
(
deserializedItem
.
rot
);
item
.
rot
=
toFloatZeroIfNull
(
deserializedItem
.
rot
);
item
.
scalex
=
toFloatOneIfNull
(
deserializedItem
.
scalex
);
item
.
scaley
=
toFloatOneIfNull
(
deserializedItem
.
scaley
);
sceneItemsList
.
Add
(
item
);
sceneItemsList
.
Add
(
item
);
}
}
...
@@ -105,6 +103,8 @@ public class DeserializedLevelsLoader
...
@@ -105,6 +103,8 @@ public class DeserializedLevelsLoader
// set rotation
// set rotation
setRot2D
(
newGameObject
,
item
.
rot
);
setRot2D
(
newGameObject
,
item
.
rot
);
setScale2D
(
newGameObject
,
item
.
scalex
,
item
.
scaley
);
// set parent
// set parent
newGameObject
.
transform
.
parent
=
parentOfXmlItems
;
newGameObject
.
transform
.
parent
=
parentOfXmlItems
;
}
}
...
@@ -119,19 +119,22 @@ public class DeserializedLevelsLoader
...
@@ -119,19 +119,22 @@ public class DeserializedLevelsLoader
void
setPos2D
(
GameObject
g
,
Vector2
pos
)
void
setPos2D
(
GameObject
g
,
Vector2
pos
)
{
{
g
.
transform
.
position
=
new
Vector
3
(
g
.
transform
.
position
=
new
Vector
2
(
pos
.
x
,
pos
.
x
,
pos
.
y
,
pos
.
y
g
.
transform
.
position
.
z
);
);
}
}
void
setRot2D
(
GameObject
g
,
float
rot
)
void
setRot2D
(
GameObject
g
,
float
rot
)
{
{
Debug
.
Log
(
"Set rotation of "
+
g
.
name
+
" to "
+
rot
);
//
Debug.Log("Set rotation of " + g.name + " to " + rot);
Quaternion
rotation
=
Quaternion
.
identity
;
Quaternion
rotation
=
Quaternion
.
identity
;
rotation
.
eulerAngles
=
new
Vector3
(
0
,
0
,
rot
);
rotation
.
eulerAngles
=
new
Vector3
(
0
,
0
,
rot
);
g
.
transform
.
localRotation
=
rotation
;
g
.
transform
.
localRotation
=
rotation
;
}
}
void
setScale2D
(
GameObject
g
,
float
scaleX
,
float
scaleY
)
{
g
.
transform
.
localScale
=
new
Vector2
(
scaleX
,
scaleY
);
}
}
}
Assets/Scripts/LevelManagement/DeserializedLevelsSaver.cs
View file @
d5824a4c
...
@@ -45,6 +45,8 @@ public class DeserializedLevelsSaver
...
@@ -45,6 +45,8 @@ public class DeserializedLevelsSaver
levelXml
.
items
[
i
].
x
=
toStringNullIfZero
(
item
.
transform
.
position
.
x
);
levelXml
.
items
[
i
].
x
=
toStringNullIfZero
(
item
.
transform
.
position
.
x
);
levelXml
.
items
[
i
].
y
=
toStringNullIfZero
(
item
.
transform
.
position
.
y
);
levelXml
.
items
[
i
].
y
=
toStringNullIfZero
(
item
.
transform
.
position
.
y
);
levelXml
.
items
[
i
].
rot
=
toStringNullIfZero
(
item
.
localRotation
.
eulerAngles
.
z
);
levelXml
.
items
[
i
].
rot
=
toStringNullIfZero
(
item
.
localRotation
.
eulerAngles
.
z
);
levelXml
.
items
[
i
].
scalex
=
toStringNullIfOne
(
item
.
localScale
.
x
);
levelXml
.
items
[
i
].
scaley
=
toStringNullIfOne
(
item
.
localScale
.
y
);
// increase i for the next cycle
// increase i for the next cycle
i
++;
i
++;
...
...
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