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
fc955810
Commit
fc955810
authored
Jul 02, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
맵 저장 및 불러오기 json 사용 방식으로 변경 완료. 이제 플레이어는 서류 가방과 상호작용함.
parent
410e7a47
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
95 deletions
+34
-95
2019-07-02-1-58-33.json
Assets/2019-07-02-1-58-33.json
+1
-0
2019-07-02-1-58-33.json.meta
Assets/2019-07-02-1-58-33.json.meta
+7
-0
MapEditorCanvas.prefab
Assets/Prefabs/MapEditor/MapEditorCanvas.prefab
+2
-3
MapManager.prefab
Assets/Prefabs/MapManager.prefab
+4
-4
SampleScene.unity
Assets/Scenes/SampleScene.unity
+0
-11
GameManager.cs
Assets/Scripts/Managers/GameManager.cs
+7
-19
MapManager.cs
Assets/Scripts/Managers/MapManager.cs
+7
-22
Map.cs
Assets/Scripts/Map/Map.cs
+0
-27
MapEditor.cs
Assets/Scripts/MapEditor.cs
+5
-4
PlayerController.cs
Assets/Scripts/PlayerController.cs
+1
-5
No files found.
Assets/2019-07-02-1-58-33.json
0 → 100644
View file @
fc955810
{
"objects"
:[{
"tag"
:
0
,
"xPos"
:
20.0
,
"yPos"
:
0.0
},{
"tag"
:
2
,
"xPos"
:
-2.0
,
"yPos"
:
0.5
},{
"tag"
:
3
,
"xPos"
:
-1.0
,
"yPos"
:
0.5
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
-1.0
},{
"tag"
:
9
,
"xPos"
:
0.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
-1.0
},{
"tag"
:
9
,
"xPos"
:
-1.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
-2.0
},{
"tag"
:
4
,
"xPos"
:
-2.0
,
"yPos"
:
-2.0
},{
"tag"
:
4
,
"xPos"
:
-1.0
,
"yPos"
:
-2.0
},{
"tag"
:
5
,
"xPos"
:
-2.0
,
"yPos"
:
1.0
},{
"tag"
:
6
,
"xPos"
:
-1.0
,
"yPos"
:
1.0
},{
"tag"
:
7
,
"xPos"
:
0.0
,
"yPos"
:
1.0
},{
"tag"
:
8
,
"xPos"
:
1.0
,
"yPos"
:
1.0
}],
"clears"
:[{
"type"
:
2
,
"goal"
:
1
},{
"type"
:
5
,
"goal"
:
1
}],
"bullets"
:[
0
,
1
,
2
]}
\ No newline at end of file
Assets/2019-07-02-1-58-33.json.meta
0 → 100644
View file @
fc955810
fileFormatVersion: 2
guid: 801379ac94c79b24cb6c73e213b0854d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Prefabs/MapEditor/MapEditorCanvas.prefab
View file @
fc955810
...
...
@@ -2668,9 +2668,8 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
5ad2f39c48d82964f86cd2d6e1e94641
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
currentMap
:
{
fileID
:
0
}
stage
:
-
{
fileID
:
630498074781569474
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
currentMap
:
{
fileID
:
630498074781569474
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
tile
:
{
fileID
:
7449840556337937162
,
guid
:
90d0ab9f40a0ddc4c871130319d86cd5
,
type
:
3
}
modeSign
:
{
fileID
:
153720729
}
startSign
:
{
fileID
:
1215997560627761150
,
guid
:
106914c4661964b47ad09efcc4bfba69
,
...
...
Assets/Prefabs/MapManager.prefab
View file @
fc955810
...
...
@@ -45,8 +45,8 @@ MonoBehaviour:
m_EditorClassIdentifier
:
isMapEditingOn
:
0
surface
:
{
fileID
:
0
}
currentMap
:
{
fileID
:
0
}
emptyMap
:
{
fileID
:
630498074781569474
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
currentMap
:
{
fileID
:
630498074781569474
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
floor
:
{
fileID
:
19711883686801522
,
guid
:
71931eea896a59a4683986cfd369b8ee
,
type
:
3
}
normalWall
:
{
fileID
:
2953616027608884528
,
guid
:
a4dcd71ec9f819f4e88c7b5ac24f4b0d
,
type
:
3
}
...
...
@@ -67,7 +67,7 @@ MonoBehaviour:
-
{
fileID
:
6840018466224391531
,
guid
:
d7070c786deaa3a4082f9339da091b46
,
type
:
3
}
-
{
fileID
:
6169104080419908266
,
guid
:
420a4f921e52a4141b80a3eefcd511e6
,
type
:
3
}
-
{
fileID
:
87051754405567689
,
guid
:
2a2831d520acdd3408d8a04673423e2a
,
type
:
3
}
players
:
[]
player
:
{
fileID
:
494213313239918027
,
guid
:
449b2ca4d925da541bb45c84b63aab98
,
type
:
3
}
players
:
[]
stage
:
-
{
fileID
:
4900000
,
guid
:
b6ac683d8d1b9b44699880e1c2bf9828
,
type
:
3
}
-
{
fileID
:
4900000
,
guid
:
801379ac94c79b24cb6c73e213b0854d
,
type
:
3
}
Assets/Scenes/SampleScene.unity
View file @
fc955810
...
...
@@ -1134,17 +1134,6 @@ PrefabInstance:
propertyPath
:
surface
value
:
objectReference
:
{
fileID
:
2102809461
}
-
target
:
{
fileID
:
3268100033343711389
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
stage.Array.data[0]
value
:
objectReference
:
{
fileID
:
4900000
,
guid
:
9bcb1c6d3d1a47046806d043fdde78d7
,
type
:
3
}
-
target
:
{
fileID
:
3268100033343711389
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
emptyMap
value
:
objectReference
:
{
fileID
:
630498074781569474
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
---
!u!1001
&7277015660625800392
...
...
Assets/Scripts/Managers/GameManager.cs
View file @
fc955810
...
...
@@ -12,12 +12,6 @@ public class GameManager : SingletonBehaviour<GameManager>
public
int
clearCounter
=
0
;
public
static
int
nFloor
,
nTurret
,
nCase
,
nPlayer
,
aFloor
,
aTurret
,
aCase
,
white
,
black
;
//Reset clear index to -1.
public
void
ResetClearIndex
()
{
nFloor
=
nTurret
=
nCase
=
nPlayer
=
aFloor
=
aTurret
=
aCase
=
white
=
black
=
-
1
;
}
//Find and set the index of clear conditions of the map to clear type.
public
void
SetClearIndex
(
Map
map
)
{
...
...
@@ -42,23 +36,17 @@ public class GameManager : SingletonBehaviour<GameManager>
Debug
.
Log
(
"Stage Clear!"
);
}
void
Awake
()
{
//Reset clear index to -1.
for
(
int
i
=
0
;
i
<
clearIndex
.
Length
;
i
++)
clearIndex
[
i
]
=
-
1
;
nFloor
=
nTurret
=
nCase
=
nPlayer
=
aFloor
=
aTurret
=
aCase
=
white
=
black
=
-
1
;
}
// Start is called before the first frame update
void
Start
()
{
if
(!
MapManager
.
inst
.
isMapEditingOn
)
MapManager
.
inst
.
LoadMap
(
MapManager
.
inst
.
stage
[
0
]);
else
{
for
(
int
i
=
0
;
i
<
9
;
i
++)
clearIndex
[
i
]
=
-
1
;
nFloor
=
clearIndex
[(
int
)
ClearType
.
NFloor
];
nTurret
=
clearIndex
[(
int
)
ClearType
.
NTurret
];
nCase
=
clearIndex
[(
int
)
ClearType
.
NCase
];
nPlayer
=
clearIndex
[(
int
)
ClearType
.
NPlayer
];
aFloor
=
clearIndex
[(
int
)
ClearType
.
AllFloor
];
aTurret
=
clearIndex
[(
int
)
ClearType
.
AllTurret
];
aCase
=
clearIndex
[(
int
)
ClearType
.
AllCase
];
white
=
clearIndex
[(
int
)
ClearType
.
White
];
black
=
clearIndex
[(
int
)
ClearType
.
Black
];
}
}
}
Assets/Scripts/Managers/MapManager.cs
View file @
fc955810
...
...
@@ -8,18 +8,19 @@ public class MapManager : SingletonBehaviour<MapManager>
{
public
bool
isMapEditingOn
;
public
NavMeshSurface
surface
;
public
Map
currentMap
,
emptyMap
;
public
Map
currentMap
;
[
Header
(
"Instances"
)]
public
Floor
floor
;
public
NormalWall
normalWall
;
public
Mirror
mirror
;
public
GameObject
truthBullet
,
fakeBullet
,
mirrorBullet
;
[
Tooltip
(
"Objects without mannequin."
)]
public
GameObject
briefCase
;
public
GameObject
cameraTurret
;
public
GameObject
[]
mannequins
;
public
List
<
GameObject
>
players
;
public
GameObject
player
;
[
Header
(
"All players"
)]
public
List
<
GameObject
>
players
;
[
Header
(
"All stages"
)]
public
TextAsset
[]
stage
;
public
BulletFactory
bulletFactory
;
...
...
@@ -29,11 +30,8 @@ public class MapManager : SingletonBehaviour<MapManager>
/// <param name="_newMap">The json file of the map data to be created.</param>
public
void
LoadMap
(
TextAsset
_newMap
)
{
if
(
currentMap
!=
null
)
Destroy
(
currentMap
.
gameObject
);
var
loadedMapData
=
JsonConvert
.
DeserializeObject
<
MapEditor
.
MapSaveData
>(
_newMap
.
ToString
());
currentMap
=
Instantiate
(
emptyMap
,
new
Vector3
(
0
,
0
,
0
),
Quaternion
.
identity
);
GameManager
.
inst
.
ResetClearIndex
();
currentMap
=
Instantiate
(
currentMap
,
new
Vector3
(
0
,
0
,
0
),
Quaternion
.
identity
);
currentMap
.
InitiateMap
();
currentMap
.
maxMapSize
=
(
int
)
loadedMapData
.
objects
[
0
].
xPos
;
for
(
int
i
=
1
;
i
<
loadedMapData
.
objects
.
Count
;
i
++)
...
...
@@ -82,21 +80,8 @@ public class MapManager : SingletonBehaviour<MapManager>
GameManager
.
inst
.
uiGenerator
.
GenerateAllClearUI
();
for
(
int
i
=
0
;
i
<
currentMap
.
startFloors
.
Count
;
i
++)
PlayerController
.
inst
.
CreatePlayer
(
currentMap
.
startFloors
[
i
]);
for
(
int
i
=
0
;
i
<
currentMap
.
initialBullets
.
Count
;
i
++)
PlayerController
.
inst
.
bulletList
.
Add
(
currentMap
.
initialBullets
[
i
]);
/*if (currentMap != null)
Destroy(currentMap.gameObject);
currentMap = Instantiate(_newMap);
currentMap.transform.position = new Vector3(0, 0, 0);
surface.BuildNavMesh();
GameManager.inst.SetClearIndex(currentMap);
GameManager.inst.uiGenerator.GenerateAllClearUI();
for (int i = 0; i < currentMap.startFloors.Count; i++)
PlayerController.inst.CreatePlayer(currentMap.startFloors[i]);
for (int i = 0; i < currentMap.initialBullets.Count; i++)
PlayerController.inst.bulletList.Add(currentMap.initialBullets[i]);*/
for
(
int
i
=
0
;
i
<
loadedMapData
.
bullets
.
Count
;
i
++)
PlayerController
.
inst
.
bulletList
.
Add
(
loadedMapData
.
bullets
[
i
]);
}
public
IEnumerator
Rebaker
()
{
...
...
Assets/Scripts/Map/Map.cs
View file @
fc955810
...
...
@@ -265,28 +265,6 @@ public class Map : MonoBehaviour
Debug
.
Log
(
"Object doesn't exists between : "
+
pos
);
}
private
void
LoadObjects
()
{
floorGrid
=
new
Dictionary
<
Vector2Int
,
Floor
>();
wallGrid
=
new
Dictionary
<
Vector2
,
Wall
>();
objectGrid
=
new
Dictionary
<
Vector2Int
,
IObject
>();
for
(
int
i
=
0
;
i
<
floors
.
transform
.
childCount
;
i
++)
{
Floor
floor
=
floors
.
transform
.
GetChild
(
i
).
GetComponent
<
Floor
>();
floorGrid
.
Add
(
floor
.
mapPos
,
floor
);
}
for
(
int
i
=
0
;
i
<
walls
.
transform
.
childCount
;
i
++)
{
Wall
wall
=
walls
.
transform
.
GetChild
(
i
).
GetComponent
<
Wall
>();
wallGrid
.
Add
(
wall
.
mapPos
,
wall
);
}
for
(
int
i
=
0
;
i
<
objects
.
transform
.
childCount
;
i
++)
{
IObject
iObject
=
objects
.
transform
.
GetChild
(
i
).
GetComponent
<
IObject
>();
objectGrid
.
Add
(
iObject
.
GetPos
(),
iObject
);
}
}
public
void
InitiateMap
()
{
floorGrid
=
new
Dictionary
<
Vector2Int
,
Floor
>();
...
...
@@ -295,11 +273,6 @@ public class Map : MonoBehaviour
startFloors
=
new
List
<
Floor
>();
}
private
void
Awake
()
{
//LoadObjects();
}
// Start is called before the first frame update
void
Start
()
{
...
...
Assets/Scripts/MapEditor.cs
View file @
fc955810
...
...
@@ -29,10 +29,12 @@ public class MapEditor : SingletonBehaviour<MapEditor>
{
public
List
<
objectData
>
objects
;
public
List
<
clearData
>
clears
;
public
List
<
BulletCode
>
bullets
;
public
MapSaveData
()
{
objects
=
new
List
<
objectData
>();
clears
=
new
List
<
clearData
>();
bullets
=
new
List
<
BulletCode
>();
}
public
void
AddObject
(
TileMode
_tag
,
Vector2
_pos
)
{
...
...
@@ -44,7 +46,6 @@ public class MapEditor : SingletonBehaviour<MapEditor>
}
}
public
Map
currentMap
;
public
Map
[]
stage
;
public
MapEditorTile
tile
;
TileMode
currentMode
;
public
Text
modeSign
;
...
...
@@ -58,8 +59,6 @@ public class MapEditor : SingletonBehaviour<MapEditor>
public
void
StartMap
(
Map
_newMap
)
{
if
(
currentMap
!=
null
)
Destroy
(
currentMap
.
gameObject
);
currentMap
=
Instantiate
(
_newMap
);
currentMap
.
transform
.
position
=
new
Vector3
(
0
,
0
,
0
);
currentMap
.
InitiateMap
();
...
...
@@ -115,6 +114,8 @@ public class MapEditor : SingletonBehaviour<MapEditor>
}
for
(
int
i
=
0
;
i
<
currentMap
.
clearConditions
.
Count
;
i
++)
mapSaveData
.
AddClears
(
currentMap
.
clearConditions
[
i
].
type
,
currentMap
.
clearConditions
[
i
].
goal
);
for
(
int
i
=
0
;
i
<
currentMap
.
initialBullets
.
Count
;
i
++)
mapSaveData
.
bullets
.
Add
(
currentMap
.
initialBullets
[
i
]);
File
.
WriteAllText
(
localPath
,
JsonConvert
.
SerializeObject
(
mapSaveData
));
Debug
.
Log
(
"Map saved at "
+
localPath
);}
}
...
...
@@ -180,7 +181,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
// Start is called before the first frame update
void
Start
()
{
StartMap
(
stage
[
0
]
);
StartMap
(
currentMap
);
SwitchMode
(
0
);
}
...
...
Assets/Scripts/PlayerController.cs
View file @
fc955810
...
...
@@ -33,7 +33,7 @@ public class PlayerController : SingletonBehaviour<PlayerController>
{
if
(
obj
.
GetComponent
<
Player
>().
currentFloor
==
floor
)
{
Debug
.
Log
(
"
there are player
on that floor."
);
Debug
.
Log
(
"
Player already exists
on that floor."
);
return
;
}
}
...
...
@@ -50,13 +50,9 @@ public class PlayerController : SingletonBehaviour<PlayerController>
public
void
CreatePlayer
(
Vector2Int
floorPos
)
{
if
(
MapManager
.
inst
.
currentMap
.
floorGrid
.
TryGetValue
(
floorPos
,
out
Floor
floor
))
{
CreatePlayer
(
floor
);
}
else
{
Debug
.
Log
(
"there are no floor"
);
}
}
public
void
RemovePlayer
(
Floor
floor
)
...
...
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