Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
man-in-the-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MIM
man-in-the-mirror
Commits
f52a29d6
Commit
f52a29d6
authored
Jul 02, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
맵 세이브 방식 수정
parent
41c1d2da
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
29 deletions
+20
-29
MapEditor.unity
Assets/Scenes/MapEditor.unity
+5
-0
MapManager.cs
Assets/Scripts/Managers/MapManager.cs
+3
-6
MapEditor.cs
Assets/Scripts/MapEditor.cs
+12
-23
No files found.
Assets/Scenes/MapEditor.unity
View file @
f52a29d6
...
...
@@ -418,6 +418,11 @@ PrefabInstance:
propertyPath
:
surface
value
:
objectReference
:
{
fileID
:
1382512383
}
-
target
:
{
fileID
:
3268100033343711389
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
asd
value
:
objectReference
:
{
fileID
:
4900000
,
guid
:
c4865e9602e96b54b89d9ecb0d3e6d1c
,
type
:
3
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
---
!u!1001
&1046587609
...
...
Assets/Scripts/Managers/MapManager.cs
View file @
f52a29d6
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEditor
;
using
UnityEngine.AI
;
using
System.Text
;
using
Newtonsoft.Json
;
public
class
MapManager
:
SingletonBehaviour
<
MapManager
>
{
...
...
@@ -24,12 +23,10 @@ public class MapManager : SingletonBehaviour<MapManager>
public
Map
[]
stage
;
public
BulletFactory
bulletFactory
;
public
TextAsset
asd
;
public
void
LoadMap
(
Map
_newMap
)
{
//var loadedMapData = JsonConvert.DeserializeObject<MapEditor.MapSaveData>(_newMap.ToString());
//loadedMapData.
/*if (currentMap != null)
...
...
Assets/Scripts/MapEditor.cs
View file @
f52a29d6
...
...
@@ -7,17 +7,6 @@ using System.IO;
public
class
MapEditor
:
SingletonBehaviour
<
MapEditor
>
{
class
MapSaveData
{
public
TileMode
tag
;
public
float
xPos
,
yPos
;
public
MapSaveData
(
TileMode
_tag
,
Vector2
_pos
)
{
tag
=
_tag
;
xPos
=
_pos
.
x
;
yPos
=
_pos
.
y
;
}
}
public
enum
TileMode
{
None
,
Floor
,
Normal
,
Mirror
,
StartFloor
,
Briefcase
,
Camera
,
WMannequin
,
BMannequin
,
goalFloor
};
public
Map
currentMap
;
public
Map
[]
stage
;
...
...
@@ -52,41 +41,41 @@ public class MapEditor : SingletonBehaviour<MapEditor>
Debug
.
Log
(
"There is no start floor."
);
else
{
List
<
MapSaveData
>
mapSaveData
=
new
List
<
MapSaveData
>
();
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
None
,
new
Vector2
(
currentMap
.
maxMapSize
,
currentMap
.
maxMapSize
)
));
MapSaveData
mapSaveData
=
new
MapSaveData
();
mapSaveData
.
Add
Object
(
TileMode
.
None
,
new
Vector2
(
currentMap
.
maxMapSize
,
0
));
foreach
(
Transform
child
in
currentMap
.
walls
.
transform
)
{
Wall
temp
=
child
.
GetComponent
<
Wall
>();
if
(
temp
is
NormalWall
)
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
Normal
,
temp
.
mapPos
)
);
mapSaveData
.
Add
Object
(
TileMode
.
Normal
,
temp
.
mapPos
);
else
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
Mirror
,
temp
.
mapPos
)
);
mapSaveData
.
Add
Object
(
TileMode
.
Mirror
,
temp
.
mapPos
);
}
foreach
(
Transform
child
in
currentMap
.
floors
.
transform
)
{
Floor
temp
=
child
.
GetComponent
<
Floor
>();
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
Floor
,
temp
.
mapPos
)
);
mapSaveData
.
Add
Object
(
TileMode
.
Floor
,
temp
.
mapPos
);
if
(
child
.
GetComponent
<
Floor
>().
isGoalFloor
)
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
goalFloor
,
temp
.
mapPos
)
);
mapSaveData
.
Add
Object
(
TileMode
.
goalFloor
,
temp
.
mapPos
);
}
foreach
(
Floor
child
in
currentMap
.
startFloors
)
{
Floor
temp
=
child
.
GetComponent
<
Floor
>();
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
StartFloor
,
temp
.
mapPos
)
);
mapSaveData
.
Add
Object
(
TileMode
.
StartFloor
,
temp
.
mapPos
);
}
foreach
(
Transform
child
in
currentMap
.
objects
.
transform
)
{
IObject
temp
=
child
.
GetComponent
<
IObject
>();
if
(
temp
.
GetType
()
==
ObjType
.
Briefcase
)
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
Briefcase
,
temp
.
GetPos
()
));
mapSaveData
.
Add
Object
(
TileMode
.
Briefcase
,
temp
.
GetPos
(
));
else
if
(
temp
.
GetType
()
==
ObjType
.
Camera
)
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
Camera
,
temp
.
GetPos
()
));
mapSaveData
.
Add
Object
(
TileMode
.
Camera
,
temp
.
GetPos
(
));
else
if
(
temp
.
GetType
()
==
ObjType
.
Mannequin
)
{
if
(
temp
.
GetObject
().
GetComponent
<
Mannequin
>().
isWhite
)
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
WMannequin
,
temp
.
GetPos
()
));
mapSaveData
.
Add
Object
(
TileMode
.
WMannequin
,
temp
.
GetPos
(
));
else
mapSaveData
.
Add
(
new
MapSaveData
(
TileMode
.
BMannequin
,
temp
.
GetPos
()
));
mapSaveData
.
Add
Object
(
TileMode
.
BMannequin
,
temp
.
GetPos
(
));
}
}
File
.
WriteAllText
(
localPath
,
JsonConvert
.
SerializeObject
(
mapSaveData
));
...
...
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