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
201277f9
Commit
201277f9
authored
Dec 22, 2019
by
15박보승
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/map'
parents
33bb28ea
b84d8cf3
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
6170 additions
and
1206 deletions
+6170
-1206
MapEditorCanvas.prefab
Assets/Prefabs/MapEditor/MapEditorCanvas.prefab
+5958
-1176
stage1_5.json
Assets/Resources/stages/stage1_5.json
+1
-0
stage1_5.json.meta
Assets/Resources/stages/stage1_5.json.meta
+7
-0
stage3_6.json
Assets/Resources/stages/stage3_6.json
+1
-0
stage3_6.json.meta
Assets/Resources/stages/stage3_6.json.meta
+7
-0
MapEditor.unity
Assets/Scenes/MapEditor.unity
+10
-0
SelectStage.unity
Assets/Scenes/SelectStage.unity
+10
-0
MapManager.cs
Assets/Scripts/Managers/MapManager.cs
+1
-1
MapEditor.cs
Assets/Scripts/MapEditor.cs
+175
-29
No files found.
Assets/Prefabs/MapEditor/MapEditorCanvas.prefab
View file @
201277f9
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Assets/Resources/stages/stage1_5.json
0 → 100644
View file @
201277f9
{
"objects"
:[{
"tag"
:
0
,
"xPos"
:
10.0
,
"yPos"
:
0.0
},{
"tag"
:
3
,
"xPos"
:
0.5
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
0.0
},{
"tag"
:
9
,
"xPos"
:
0.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
-1.0
},{
"tag"
:
4
,
"xPos"
:
0.0
,
"yPos"
:
-1.0
}],
"clears"
:[{
"type"
:
0
,
"goal"
:
2
}],
"cases"
:[],
"bullets"
:[
1
],
"comments"
:
""
}
\ No newline at end of file
Assets/Resources/stages/stage1_5.json.meta
0 → 100644
View file @
201277f9
fileFormatVersion: 2
guid: 4b068fe8eb3b7914780b06dca7247d5d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/stages/stage3_6.json
0 → 100644
View file @
201277f9
{
"objects"
:[{
"tag"
:
0
,
"xPos"
:
125.0
,
"yPos"
:
0.0
},{
"tag"
:
2
,
"xPos"
:
-1.0
,
"yPos"
:
-1.5
},{
"tag"
:
2
,
"xPos"
:
-0.5
,
"yPos"
:
-1.0
},{
"tag"
:
3
,
"xPos"
:
-1.0
,
"yPos"
:
-0.5
},{
"tag"
:
2
,
"xPos"
:
0.5
,
"yPos"
:
-1.0
},{
"tag"
:
2
,
"xPos"
:
1.0
,
"yPos"
:
-1.5
},{
"tag"
:
3
,
"xPos"
:
1.0
,
"yPos"
:
0.5
},{
"tag"
:
2
,
"xPos"
:
0.5
,
"yPos"
:
1.0
},{
"tag"
:
2
,
"xPos"
:
1.5
,
"yPos"
:
-2.0
},{
"tag"
:
2
,
"xPos"
:
-1.5
,
"yPos"
:
1.0
},{
"tag"
:
2
,
"xPos"
:
2.0
,
"yPos"
:
-0.5
},{
"tag"
:
2
,
"xPos"
:
1.5
,
"yPos"
:
2.0
},{
"tag"
:
2
,
"xPos"
:
-1.5
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
-2.0
},{
"tag"
:
9
,
"xPos"
:
0.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
2.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
2.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
2.0
,
"yPos"
:
0.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"
:
-1.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
2.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
1.0
},{
"tag"
:
4
,
"xPos"
:
-2.0
,
"yPos"
:
-2.0
},{
"tag"
:
6
,
"xPos"
:
0.0
,
"yPos"
:
0.0
},{
"tag"
:
5
,
"xPos"
:
2.0
,
"yPos"
:
-2.0
}],
"clears"
:[{
"type"
:
0
,
"goal"
:
1
}],
"cases"
:[
0
],
"bullets"
:[
1
,
1
],
"comments"
:
""
}
\ No newline at end of file
Assets/Resources/stages/stage3_6.json.meta
0 → 100644
View file @
201277f9
fileFormatVersion: 2
guid: ecdc62db53252b74e941be358fbe04fb
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scenes/MapEditor.unity
View file @
201277f9
...
...
@@ -253,6 +253,16 @@ PrefabInstance:
propertyPath
:
m_LocalEulerAnglesHint.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2028998455926151720
,
guid
:
06619682524bc5149b5c3092da0722f2
,
type
:
3
}
propertyPath
:
m_Options.m_Options.Array.size
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2028998455926151720
,
guid
:
06619682524bc5149b5c3092da0722f2
,
type
:
3
}
propertyPath
:
m_Options.m_Options.Array.data[3].m_Text
value
:
Option C
objectReference
:
{
fileID
:
0
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
06619682524bc5149b5c3092da0722f2
,
type
:
3
}
---
!u!1001
&463381731
...
...
Assets/Scenes/SelectStage.unity
View file @
201277f9
...
...
@@ -487,6 +487,16 @@ PrefabInstance:
propertyPath
:
categoryCounts.Array.data[1]
value
:
4
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
5996849666618765155
,
guid
:
8115fd4d1a1025b4fb05e45fc5fa6578
,
type
:
3
}
propertyPath
:
categoryCounts.Array.data[0]
value
:
5
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
5996849666618765155
,
guid
:
8115fd4d1a1025b4fb05e45fc5fa6578
,
type
:
3
}
propertyPath
:
categoryCounts.Array.data[2]
value
:
6
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
5087174722634247129
,
guid
:
8115fd4d1a1025b4fb05e45fc5fa6578
,
type
:
3
}
propertyPath
:
m_AnchorMax.x
...
...
Assets/Scripts/Managers/MapManager.cs
View file @
201277f9
...
...
@@ -86,7 +86,7 @@ public class MapManager : SingletonBehaviour<MapManager>
PlayerController
.
inst
.
CreatePlayer
(
currentMap
.
startFloors
[
i
]);
for
(
int
i
=
0
;
i
<
loadedMapData
.
bullets
.
Count
;
i
++)
PlayerController
.
inst
.
AddBullet
(
loadedMapData
.
bullets
[
i
]);
if
(
loadedMapData
.
comments
!=
null
)
if
(
loadedMapData
.
comments
!=
null
&&
loadedMapData
.
comments
!=
""
)
{
currentMap
.
comments
=
loadedMapData
.
comments
;
GameManager
.
inst
.
commentUIGenerator
.
SetComment
(
currentMap
.
comments
);
...
...
Assets/Scripts/MapEditor.cs
View file @
201277f9
...
...
@@ -4,48 +4,49 @@ using UnityEngine;
using
UnityEngine.UI
;
using
Newtonsoft.Json
;
using
System.IO
;
using
UnityEngine.SceneManagement
;
public
class
MapEditor
:
SingletonBehaviour
<
MapEditor
>
{
public
class
o
bjectData
public
class
O
bjectData
{
public
TileMode
tag
;
public
float
xPos
,
yPos
;
public
o
bjectData
(
TileMode
_tag
,
Vector2
_pos
)
public
O
bjectData
(
TileMode
_tag
,
Vector2
_pos
)
{
tag
=
_tag
;
xPos
=
_pos
.
x
;
yPos
=
_pos
.
y
;
}
}
public
class
c
learData
public
class
C
learData
{
public
ClearType
type
;
public
int
goal
;
public
c
learData
(
ClearType
_type
,
int
_goal
)
public
C
learData
(
ClearType
_type
,
int
_goal
)
{
type
=
_type
;
goal
=
_goal
;
}
}
public
class
MapSaveData
{
public
List
<
o
bjectData
>
objects
;
public
List
<
c
learData
>
clears
;
public
List
<
O
bjectData
>
objects
;
public
List
<
C
learData
>
clears
;
public
List
<
BulletCode
>
cases
;
public
List
<
BulletCode
>
bullets
;
public
string
comments
=
null
;
public
MapSaveData
()
{
objects
=
new
List
<
o
bjectData
>();
clears
=
new
List
<
c
learData
>();
objects
=
new
List
<
O
bjectData
>();
clears
=
new
List
<
C
learData
>();
cases
=
new
List
<
BulletCode
>();
bullets
=
new
List
<
BulletCode
>();
}
public
void
AddObject
(
TileMode
_tag
,
Vector2
_pos
)
{
objects
.
Add
(
new
o
bjectData
(
_tag
,
_pos
));
objects
.
Add
(
new
O
bjectData
(
_tag
,
_pos
));
}
public
void
AddClears
(
ClearType
_type
,
int
_goal
)
{
clears
.
Add
(
new
c
learData
(
_type
,
_goal
));
clears
.
Add
(
new
C
learData
(
_type
,
_goal
));
}
}
public
Map
currentMap
;
...
...
@@ -53,14 +54,18 @@ public class MapEditor : SingletonBehaviour<MapEditor>
TileMode
currentMode
;
BulletCode
bulletMode
;
public
Text
modeSign
;
public
GameObject
startSign
,
goalSign
,
mapSizeSetter
,
mapEditorTiles
;
public
GameObject
startSign
,
goalSign
,
mapSizeSetter
,
saveMapSelector
,
loadMapSelector
,
mapEditorTiles
;
public
Dropdown
goalDropdown
;
public
InputField
goalInputField
;
public
Dictionary
<
Floor
,
GameObject
>
startSigns
,
goalSigns
;
public
Material
editNormalMat
;
bool
isEditorStarted
;
public
bool
isEditorStarted
;
bool
isCreateMode
;
public
string
mapName
;
public
void
StartMap
(
Map
_newMap
)
{
currentMap
=
Instantiate
(
_newMap
);
...
...
@@ -71,14 +76,20 @@ public class MapEditor : SingletonBehaviour<MapEditor>
/// Saves map to Assets folder.
/// </summary>
/// <param name="_newMap"></param>
public
void
SaveMap
(
Map
_newMap
)
public
void
SaveMap
()
{
saveMapSelector
.
SetActive
(
false
);
Map
_newMap
=
currentMap
;
/* 맵 저장 시 반드시 승리 조건 작성할 것
* 목표가 '모든'일 경우 승리 목표는 초기 맵 기준으로 작성
*/
System
.
DateTime
time
=
System
.
DateTime
.
Now
;
string
localPath
=
"Assets/"
+
time
.
ToShortDateString
()
+
"-"
+
time
.
Hour
+
"-"
+
time
.
Minute
+
"-"
+
time
.
Second
+
".json"
;
if
(
currentMap
.
startFloors
.
Count
==
0
)
var
x
=
saveMapSelector
.
transform
.
Find
(
"x"
).
GetComponent
<
InputField
>();
var
y
=
saveMapSelector
.
transform
.
Find
(
"y"
).
GetComponent
<
InputField
>();
mapName
=
x
.
text
+
"_"
+
y
.
text
;
//System.DateTime time = System.DateTime.Now;
//string localPath = "Assets/" + time.ToShortDateString() + "-" + time.Hour + "-" + time.Minute + "-" + time.Second + ".json";
string
localPath
=
"Assets/Resources/Stages/stage"
+
mapName
+
".json"
;
if
(
currentMap
.
startFloors
.
Count
==
0
)
Debug
.
Log
(
"There is no start floor."
);
else
{
...
...
@@ -126,13 +137,92 @@ public class MapEditor : SingletonBehaviour<MapEditor>
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
]);
mapSaveData
.
comments
=
currentMap
.
comments
;
if
(
File
.
Exists
(
localPath
))
{
Debug
.
Log
(
"File Exists"
);
File
.
Delete
(
localPath
);
}
File
.
WriteAllText
(
localPath
,
JsonConvert
.
SerializeObject
(
mapSaveData
));
Debug
.
Log
(
"Map saved at "
+
localPath
);}
}
public
void
SaveCurrentMap
()
public
void
LoadMap
()
{
loadMapSelector
.
SetActive
(
false
);
var
x
=
loadMapSelector
.
transform
.
Find
(
"x"
).
GetComponent
<
InputField
>();
var
y
=
loadMapSelector
.
transform
.
Find
(
"y"
).
GetComponent
<
InputField
>();
mapName
=
x
.
text
+
"_"
+
y
.
text
;
TextAsset
_newMap
=
Resources
.
Load
(
"Stages/stage"
+
mapName
)
as
TextAsset
;
if
(
_newMap
!=
null
)
{
SaveMap
(
currentMap
);
var
loadedMapData
=
JsonConvert
.
DeserializeObject
<
MapEditor
.
MapSaveData
>(
_newMap
.
ToString
());
InputField
xInput
=
mapSizeSetter
.
transform
.
Find
(
"x"
).
GetComponent
<
InputField
>();
InputField
yInput
=
mapSizeSetter
.
transform
.
Find
(
"y"
).
GetComponent
<
InputField
>();
xInput
.
text
=
loadedMapData
.
objects
[
0
].
xPos
.
ToString
();
yInput
.
text
=
loadedMapData
.
objects
[
0
].
xPos
.
ToString
();
SetMapSize
();
for
(
int
i
=
0
;
i
<
loadedMapData
.
clears
.
Count
;
i
++)
{
var
temp
=
loadedMapData
.
clears
[
i
];
currentMap
.
clearConditions
.
Add
(
new
ClearCondition
(
temp
.
type
,
temp
.
goal
));
}
int
casesIndex
=
0
;
for
(
int
i
=
1
;
i
<
loadedMapData
.
objects
.
Count
;
i
++)
{
var
temp
=
loadedMapData
.
objects
[
i
];
switch
(
temp
.
tag
)
{
case
TileMode
.
Floor
:
currentMap
.
CreateFloor
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
));
break
;
case
TileMode
.
Normal
:
currentMap
.
CreateWall
(
new
Vector2
(
temp
.
xPos
,
temp
.
yPos
),
WallType
.
Normal
);
if
(
currentMap
.
GetWallAtPos
(
new
Vector2
(
temp
.
xPos
,
temp
.
yPos
))
!=
null
&&
currentMap
.
GetWallAtPos
(
new
Vector2
(
temp
.
xPos
,
temp
.
yPos
)).
GetComponent
<
Wall
>()
is
NormalWall
)
currentMap
.
GetWallAtPos
(
new
Vector2
(
temp
.
xPos
,
temp
.
yPos
)).
gameObject
.
GetComponent
<
MeshRenderer
>().
material
=
editNormalMat
;
break
;
case
TileMode
.
Mirror
:
currentMap
.
CreateWall
(
new
Vector2
(
temp
.
xPos
,
temp
.
yPos
),
WallType
.
Mirror
);
break
;
case
TileMode
.
StartFloor
:
currentMap
.
startFloors
.
Add
(
currentMap
.
GetFloorAtPos
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
)));
startSigns
.
Add
(
currentMap
.
GetFloorAtPos
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
)),
Instantiate
(
startSign
));
startSigns
[
currentMap
.
GetFloorAtPos
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
))].
transform
.
position
=
new
Vector3
(
temp
.
xPos
,
2
,
temp
.
yPos
);
break
;
case
TileMode
.
Briefcase
:
currentMap
.
CreateObject
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
),
ObjType
.
Briefcase
,
loadedMapData
.
cases
[
casesIndex
++]);
break
;
case
TileMode
.
Camera
:
currentMap
.
CreateObject
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
),
ObjType
.
Camera
);
break
;
case
TileMode
.
WMannequin
:
currentMap
.
CreateObject
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
),
ObjType
.
Mannequin
,
true
);
break
;
case
TileMode
.
BMannequin
:
currentMap
.
CreateObject
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
),
ObjType
.
Mannequin
,
false
);
break
;
case
TileMode
.
goalFloor
:
currentMap
.
SetGoalFloor
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
));
goalSigns
.
Add
(
currentMap
.
GetFloorAtPos
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
)),
Instantiate
(
goalSign
));
goalSigns
[
currentMap
.
GetFloorAtPos
(
new
Vector2Int
((
int
)
temp
.
xPos
,
(
int
)
temp
.
yPos
))].
transform
.
position
=
new
Vector3
(
temp
.
xPos
,
2
,
temp
.
yPos
);
break
;
default
:
break
;
}
}
for
(
int
i
=
0
;
i
<
loadedMapData
.
bullets
.
Count
;
i
++)
currentMap
.
initialBullets
.
Add
(
loadedMapData
.
bullets
[
i
]);
if
(
loadedMapData
.
comments
!=
null
)
currentMap
.
comments
=
loadedMapData
.
comments
;
xInput
.
text
=
(
currentMap
.
maxBorder
.
x
-
currentMap
.
minBorder
.
x
+
1
).
ToString
();
yInput
.
text
=
(
currentMap
.
maxBorder
.
y
-
currentMap
.
minBorder
.
y
+
1
).
ToString
();
SetMapSize
();
}
}
public
void
SetMapSize
()
{
InputField
xInput
=
mapSizeSetter
.
transform
.
Find
(
"x"
).
GetComponent
<
InputField
>();
...
...
@@ -153,6 +243,22 @@ public class MapEditor : SingletonBehaviour<MapEditor>
public
void
ResizeMap
()
{
mapSizeSetter
.
SetActive
(
true
);
saveMapSelector
.
SetActive
(
false
);
loadMapSelector
.
SetActive
(
false
);
isEditorStarted
=
false
;
}
public
void
LoadMapButton
()
{
mapSizeSetter
.
SetActive
(
false
);
saveMapSelector
.
SetActive
(
false
);
loadMapSelector
.
SetActive
(
true
);
isEditorStarted
=
false
;
}
public
void
SaveMapButton
()
{
mapSizeSetter
.
SetActive
(
false
);
saveMapSelector
.
SetActive
(
true
);
loadMapSelector
.
SetActive
(
false
);
isEditorStarted
=
false
;
}
public
void
SwitchMode
(
int
_tileMode
)
...
...
@@ -180,8 +286,36 @@ public class MapEditor : SingletonBehaviour<MapEditor>
}
public
void
AddBulletToPlayer
(
int
bulletMode
)
{
currentMap
.
initialBullets
.
Add
((
BulletCode
)
bulletMode
);
//PlayerController.inst.bulletList.Add((BulletCode)bulletMode);
if
(
bulletMode
<
0
)
currentMap
.
initialBullets
.
Clear
();
else
currentMap
.
initialBullets
.
Add
((
BulletCode
)
bulletMode
);
}
public
void
TestMapStart
()
{
if
(
mapName
!=
""
)
{
StageSelector
.
selectedStage
=
mapName
;
SceneManager
.
LoadScene
(
"PlayStage"
);
}
else
{
Debug
.
Log
(
"Save Your Map!"
);
}
}
public
void
AddClearCondition
()
{
ClearType
c
=
(
ClearType
)
System
.
Enum
.
Parse
(
typeof
(
ClearType
),
goalDropdown
.
options
[
goalDropdown
.
value
].
text
);
int
n
=
int
.
Parse
(
goalInputField
.
text
);
if
(
n
>=
0
)
{
currentMap
.
clearConditions
.
Add
(
new
ClearCondition
(
c
,
n
));
}
}
public
void
ClearClearCondition
()
{
currentMap
.
clearConditions
.
Clear
();
}
private
void
Awake
()
...
...
@@ -200,36 +334,49 @@ public class MapEditor : SingletonBehaviour<MapEditor>
StartMap
(
currentMap
);
SwitchMode
(
0
);
SwitchBulletMode
((
int
)
BulletCode
.
None
);
goalDropdown
.
options
.
Clear
();
foreach
(
ClearType
c
in
(
ClearType
[])
System
.
Enum
.
GetValues
(
typeof
(
ClearType
)))
{
goalDropdown
.
options
.
Add
(
new
Dropdown
.
OptionData
(
c
.
ToString
()));
}
goalDropdown
.
value
=
0
;
}
// Update is called once per frame
void
Update
()
{
if
(
isEditorStarted
&&
Input
.
GetMouseButton
Down
(
0
)
)
if
(
isEditorStarted
&&
Input
.
GetMouseButton
(
0
)
&&
Input
.
mousePosition
.
x
>
250
&&
Input
.
mousePosition
.
x
<
1550
)
{
Ray
mouseRay
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
RaycastHit
hit
;
bool
isWall
=
false
;
if
(
Physics
.
Raycast
(
mouseRay
,
out
hit
))
{
Debug
.
Log
(
hit
.
transform
.
position
);
Vector2Int
clickedPos
=
Vector2Int
.
zero
;
Vector2
wallPos
=
Vector2
.
zero
;
if
(
hit
.
transform
.
tag
==
"wallSign"
)
{
wallPos
=
new
Vector2
(
hit
.
transform
.
position
.
x
,
hit
.
transform
.
position
.
z
);
isWall
=
true
;
}
else
{
clickedPos
=
new
Vector2Int
((
int
)
hit
.
transform
.
position
.
x
,
(
int
)
hit
.
transform
.
position
.
z
);
if
(
currentMode
==
TileMode
.
Floor
)
isWall
=
false
;
}
if
(
currentMode
==
TileMode
.
Floor
&&
!
isWall
)
{
if
(
isCreateMode
)
currentMap
.
CreateFloor
(
clickedPos
);
else
currentMap
.
RemoveFloor
(
clickedPos
);
}
else
if
(
currentMode
==
TileMode
.
Normal
||
currentMode
==
TileMode
.
Mirror
)
else
if
(
currentMode
==
TileMode
.
Normal
||
currentMode
==
TileMode
.
Mirror
&&
isWall
)
{
if
(
isCreateMode
)
{
Debug
.
Log
(
wallPos
);
currentMap
.
CreateWall
(
wallPos
,
(
WallType
)((
int
)
currentMode
-
1
));
if
(
currentMap
.
GetWallAtPos
(
wallPos
)
!=
null
&&
currentMap
.
GetWallAtPos
(
wallPos
).
GetComponent
<
Wall
>()
is
NormalWall
)
currentMap
.
GetWallAtPos
(
wallPos
).
gameObject
.
GetComponent
<
MeshRenderer
>().
material
=
editNormalMat
;
...
...
@@ -237,7 +384,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
else
currentMap
.
RemoveWall
(
wallPos
);
}
else
if
(
currentMode
==
TileMode
.
StartFloor
)
else
if
(
currentMode
==
TileMode
.
StartFloor
&&
!
isWall
)
{
if
(
isCreateMode
)
{
...
...
@@ -262,7 +409,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
}
}
}
else
if
(
currentMode
==
TileMode
.
goalFloor
)
else
if
(
currentMode
==
TileMode
.
goalFloor
&&
isWall
)
{
if
(
isCreateMode
)
{
...
...
@@ -271,8 +418,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
else
{
currentMap
.
GetFloorAtPos
(
clickedPos
).
isGoalFloor
=
true
;
goalSigns
.
Add
(
currentMap
.
GetFloorAtPos
(
clickedPos
),
Instantiate
(
goalSign
));
goalSigns
.
Add
(
currentMap
.
GetFloorAtPos
(
clickedPos
),
Instantiate
(
goalSign
));
goalSigns
[
currentMap
.
GetFloorAtPos
(
clickedPos
)].
transform
.
position
=
new
Vector3
(
clickedPos
.
x
,
2
,
clickedPos
.
y
);
}
}
...
...
@@ -288,7 +434,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
}
}
}
else
if
((
int
)
currentMode
>=
5
&&
(
int
)
currentMode
<=
8
)
else
if
((
int
)
currentMode
>=
5
&&
(
int
)
currentMode
<=
8
&&
isWall
)
{
if
(
isCreateMode
)
{
...
...
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