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
bc050b1c
Commit
bc050b1c
authored
Mar 24, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
현재 맵 정보 세이브 및 로드 기능 구현
parent
200e72d7
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
11634 additions
and
156 deletions
+11634
-156
EmptyStage.prefab
Assets/Prefabs/Map/EmptyStage.prefab
+0
-0
EmptyStage.prefab.meta
Assets/Prefabs/Map/EmptyStage.prefab.meta
+0
-0
TestTools.prefab
Assets/Prefabs/TestTools.prefab
+213
-4
SampleScene.unity
Assets/Scenes/SampleScene.unity
+28
-130
Floor.cs
Assets/Scripts/Map/Floor.cs
+3
-3
Map.cs
Assets/Scripts/Map/Map.cs
+26
-10
Wall.cs
Assets/Scripts/Map/Wall.cs
+3
-3
MapManager.cs
Assets/Scripts/MapManager.cs
+21
-2
PlayerController.cs
Assets/Scripts/PlayerController.cs
+1
-1
TestTools.cs
Assets/Scripts/TestTools.cs
+9
-0
TestStage.prefab
Assets/TestStage.prefab
+11328
-0
TestStage.prefab.meta
Assets/TestStage.prefab.meta
+2
-3
No files found.
Assets/Prefabs/Map/
Test
Stage.prefab
→
Assets/Prefabs/Map/
Empty
Stage.prefab
View file @
bc050b1c
File moved
Assets/Prefabs/Map/
Test
Stage.prefab.meta
→
Assets/Prefabs/Map/
Empty
Stage.prefab.meta
View file @
bc050b1c
File moved
Assets/Prefabs/TestTools.prefab
View file @
bc050b1c
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1
&738553008
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
738553009
}
-
component
:
{
fileID
:
738553011
}
-
component
:
{
fileID
:
738553010
}
m_Layer
:
5
m_Name
:
Text
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!224
&738553009
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
738553008
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
1397994405
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
1
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!222
&738553011
CanvasRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
738553008
}
m_CullTransparentMesh
:
0
---
!u!114
&738553010
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
738553008
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
708705254
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
0.19607843
,
g
:
0.19607843
,
b
:
0.19607843
,
a
:
1
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData
:
m_Font
:
{
fileID
:
10102
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_FontSize
:
14
m_FontStyle
:
0
m_BestFit
:
0
m_MinSize
:
10
m_MaxSize
:
40
m_Alignment
:
4
m_AlignByGeometry
:
0
m_RichText
:
1
m_HorizontalOverflow
:
0
m_VerticalOverflow
:
0
m_LineSpacing
:
1
m_Text
:
Save current map
---
!u!1
&1397994404
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1397994405
}
-
component
:
{
fileID
:
1397994408
}
-
component
:
{
fileID
:
1397994407
}
-
component
:
{
fileID
:
1397994406
}
m_Layer
:
5
m_Name
:
Save
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!224
&1397994405
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1397994404
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
-
{
fileID
:
738553009
}
m_Father
:
{
fileID
:
1444571407667829093
}
m_RootOrder
:
2
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
1
}
m_AnchorMax
:
{
x
:
0
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
123
,
y
:
-611
}
m_SizeDelta
:
{
x
:
160
,
y
:
30
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!222
&1397994408
CanvasRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1397994404
}
m_CullTransparentMesh
:
0
---
!u!114
&1397994407
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1397994404
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-765806418
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite
:
{
fileID
:
10905
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_Type
:
1
m_PreserveAspect
:
0
m_FillCenter
:
1
m_FillMethod
:
4
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
m_UseSpriteMesh
:
0
---
!u!114
&1397994406
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1397994404
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1392445389
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Navigation
:
m_Mode
:
3
m_SelectOnUp
:
{
fileID
:
0
}
m_SelectOnDown
:
{
fileID
:
0
}
m_SelectOnLeft
:
{
fileID
:
0
}
m_SelectOnRight
:
{
fileID
:
0
}
m_Transition
:
1
m_Colors
:
m_NormalColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_HighlightedColor
:
{
r
:
0.9607843
,
g
:
0.9607843
,
b
:
0.9607843
,
a
:
1
}
m_PressedColor
:
{
r
:
0.78431374
,
g
:
0.78431374
,
b
:
0.78431374
,
a
:
1
}
m_DisabledColor
:
{
r
:
0.78431374
,
g
:
0.78431374
,
b
:
0.78431374
,
a
:
0.5019608
}
m_ColorMultiplier
:
1
m_FadeDuration
:
0.1
m_SpriteState
:
m_HighlightedSprite
:
{
fileID
:
0
}
m_PressedSprite
:
{
fileID
:
0
}
m_DisabledSprite
:
{
fileID
:
0
}
m_AnimationTriggers
:
m_NormalTrigger
:
Normal
m_HighlightedTrigger
:
Highlighted
m_PressedTrigger
:
Pressed
m_DisabledTrigger
:
Disabled
m_Interactable
:
1
m_TargetGraphic
:
{
fileID
:
1397994407
}
m_OnClick
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
1615184088
}
m_MethodName
:
SaveMap
m_Mode
:
1
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
UnityEngine.Object, UnityEngine
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
---
!u!1
&356685241964599882
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -652,6 +860,7 @@ RectTransform:
m_Children
:
-
{
fileID
:
4609862474233688060
}
-
{
fileID
:
3620727262082854988
}
-
{
fileID
:
1397994405
}
m_Father
:
{
fileID
:
1444571408780882984
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
...
...
@@ -994,8 +1203,8 @@ MonoBehaviour:
m_OnClick
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
0
}
m_MethodName
:
Add
Tile
-
m_Target
:
{
fileID
:
1615184088
}
m_MethodName
:
Add
Floor
m_Mode
:
1
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
...
...
@@ -1314,8 +1523,8 @@ MonoBehaviour:
m_OnClick
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
0
}
m_MethodName
:
Remove
Tile
-
m_Target
:
{
fileID
:
1615184088
}
m_MethodName
:
Remove
Floor
m_Mode
:
1
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
...
...
Assets/Scenes/SampleScene.unity
View file @
bc050b1c
...
...
@@ -181,81 +181,6 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
1
m_LocalEulerAnglesHint
:
{
x
:
50
,
y
:
-30
,
z
:
0
}
---
!u!1
&170803409
stripped
GameObject
:
m_CorrespondingSourceObject
:
{
fileID
:
8862060874303168220
,
guid
:
6ba287375b5ad4b458a7b7b99c6d6a08
,
type
:
3
}
m_PrefabInstance
:
{
fileID
:
8862060874401324557
}
m_PrefabAsset
:
{
fileID
:
0
}
---
!u!1001
&238520940
PrefabInstance
:
m_ObjectHideFlags
:
0
serializedVersion
:
2
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
-
target
:
{
fileID
:
630498074781569472
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_Name
value
:
TestStage
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalPosition.x
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalPosition.y
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalPosition.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalRotation.x
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalRotation.y
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalRotation.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalRotation.w
value
:
1
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_RootOrder
value
:
8
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalEulerAnglesHint.x
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalEulerAnglesHint.y
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
630498074781569475
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
propertyPath
:
m_LocalEulerAnglesHint.z
value
:
0
objectReference
:
{
fileID
:
0
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
759f352c81f1b5a40b2d8d241cdf273b
,
type
:
3
}
---
!u!1
&534669902
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -351,30 +276,6 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c7d507df55441f7438f6f059e9d2587c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!114
&1615184088
stripped
MonoBehaviour
:
m_CorrespondingSourceObject
:
{
fileID
:
1615184088
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
m_PrefabInstance
:
{
fileID
:
1444571407246859822
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
9b8e1e408cd84db4583dba90a6a06169
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!114
&1908494592
stripped
MonoBehaviour
:
m_CorrespondingSourceObject
:
{
fileID
:
6014610519130626207
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
m_PrefabInstance
:
{
fileID
:
6014610517247297951
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
9c46ee6a780f2c3428a79748eadabea8
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!114
&2102809461
stripped
MonoBehaviour
:
m_CorrespondingSourceObject
:
{
fileID
:
7277015661519863741
,
guid
:
20dee07e28273f049a9093ae4453912f
,
...
...
@@ -534,6 +435,11 @@ PrefabInstance:
propertyPath
:
m_Name
value
:
TestTools
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
1444571407667829093
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_LocalPosition.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
1444571408780882984
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_LocalPosition.x
...
...
@@ -589,36 +495,6 @@ PrefabInstance:
propertyPath
:
m_LocalEulerAnglesHint.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
1444571407947569431
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value
:
objectReference
:
{
fileID
:
1615184088
}
-
target
:
{
fileID
:
1444571407947569431
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value
:
AddFloor
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
1444571408874085628
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value
:
objectReference
:
{
fileID
:
1615184088
}
-
target
:
{
fileID
:
1444571408874085628
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value
:
RemoveFloor
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
1444571407667829093
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_LocalPosition.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
1828251375556061743
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value
:
objectReference
:
{
fileID
:
1908494592
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
---
!u!1001
&6014610517247297951
...
...
@@ -633,16 +509,38 @@ PrefabInstance:
propertyPath
:
m_Name
value
:
MapManager
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6014610519130626207
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
stage.Array.size
value
:
1
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6014610519130626207
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
player
value
:
objectReference
:
{
fileID
:
170803409
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6014610519130626207
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
surface
value
:
objectReference
:
{
fileID
:
2102809461
}
-
target
:
{
fileID
:
6014610519130626207
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
stage.Array.data[1]
value
:
objectReference
:
{
fileID
:
791563843738455658
,
guid
:
d023f0193ec85eb4abdc3e04bb4d7778
,
type
:
3
}
-
target
:
{
fileID
:
6014610519130626207
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
stage.Array.data[0]
value
:
objectReference
:
{
fileID
:
5554172594464001467
,
guid
:
20fb0f72e3df40c488f15711aa30ac6e
,
type
:
3
}
-
target
:
{
fileID
:
6014610519130626207
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
currentMap
value
:
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6014610519130626206
,
guid
:
11285456de5f1854d947bea83275646f
,
type
:
3
}
propertyPath
:
m_LocalPosition.x
...
...
Assets/Scripts/Map/Floor.cs
View file @
bc050b1c
...
...
@@ -7,11 +7,11 @@ public class Floor : MonoBehaviour
/// <summary>
/// Position of this floor at the map.
/// </summary>
public
Vector2Int
MapPos
{
get
;
private
set
;
}
public
Vector2Int
mapPos
;
public
void
Set
M
apPos
(
Vector2Int
pos
)
public
void
Set
m
apPos
(
Vector2Int
pos
)
{
M
apPos
=
pos
;
m
apPos
=
pos
;
}
// Start is called before the first frame update
...
...
Assets/Scripts/Map/Map.cs
View file @
bc050b1c
...
...
@@ -11,6 +11,7 @@ public class Map : MonoBehaviour
private
Dictionary
<
Vector2
,
Wall
>
wallGrid
;
public
GameObject
floors
;
public
GameObject
walls
;
public
Floor
startFloor
;
/// <summary>
/// Get floor at position.
...
...
@@ -45,7 +46,7 @@ public class Map : MonoBehaviour
/// <returns></returns>
public
Wall
GetWallAtPos
(
Floor
floor1
,
Floor
floor2
)
{
Vector2
wallPos
=
(
Vector2
)(
floor1
.
MapPos
+
floor2
.
M
apPos
)
/
2
;
Vector2
wallPos
=
(
Vector2
)(
floor1
.
mapPos
+
floor2
.
m
apPos
)
/
2
;
return
wallGrid
.
ContainsKey
(
wallPos
)
?
wallGrid
[
wallPos
]
:
null
;
}
/// <summary>
...
...
@@ -64,7 +65,7 @@ public class Map : MonoBehaviour
if
(!
floorGrid
.
ContainsKey
(
floorPos
))
{
floorGrid
.
Add
(
floorPos
,
Instantiate
(
MapManager
.
inst
.
floor
,
new
Vector3
(
floorPos
.
x
,
0
,
floorPos
.
y
),
Quaternion
.
identity
,
floors
.
transform
).
GetComponent
<
Floor
>());
floorGrid
[
floorPos
].
Set
M
apPos
(
floorPos
);
floorGrid
[
floorPos
].
Set
m
apPos
(
floorPos
);
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
}
else
...
...
@@ -130,16 +131,16 @@ public class Map : MonoBehaviour
/// <param name="floor2"></param>
public
void
CreateWall
(
Floor
floor1
,
Floor
floor2
)
{
Vector2
wallPos
=
(
Vector2
)(
floor1
.
MapPos
+
floor2
.
M
apPos
)
/
2
;
Vector2
wallPos
=
(
Vector2
)(
floor1
.
mapPos
+
floor2
.
m
apPos
)
/
2
;
if
(!
wallGrid
.
ContainsKey
(
wallPos
))
{
wallGrid
.
Add
(
wallPos
,
Instantiate
(
MapManager
.
inst
.
wall
,
new
Vector3
(
wallPos
.
x
,
0
,
wallPos
.
y
),
Quaternion
.
identity
,
walls
.
transform
).
GetComponent
<
Wall
>());
wallGrid
[
wallPos
].
Set
M
apPos
(
wallPos
);
wallGrid
[
wallPos
].
Set
m
apPos
(
wallPos
);
wallGrid
[
wallPos
].
transform
.
LookAt
(
floor1
.
transform
);
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
}
else
Debug
.
Log
(
"Wall already exists between : "
+
floor1
.
MapPos
+
", "
+
floor2
.
M
apPos
);
Debug
.
Log
(
"Wall already exists between : "
+
floor1
.
mapPos
+
", "
+
floor2
.
m
apPos
);
}
/// <summary>
/// Create walls from two floors, toward dir's direction.
...
...
@@ -150,8 +151,8 @@ public class Map : MonoBehaviour
/// <param name="length">Amount of walls you want to create.</param>
public
void
CreateWall
(
Floor
floor1
,
Floor
floor2
,
Vector2
dir
,
int
length
)
{
Vector2Int
floor1Pos
=
floor1
.
M
apPos
;
Vector2Int
floor2Pos
=
floor2
.
M
apPos
;
Vector2Int
floor1Pos
=
floor1
.
m
apPos
;
Vector2Int
floor2Pos
=
floor2
.
m
apPos
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
if
(
GetFloorAtPos
(
floor1Pos
)
==
null
||
GetFloorAtPos
(
floor2Pos
)
==
null
)
...
...
@@ -171,7 +172,7 @@ public class Map : MonoBehaviour
/// <param name="floor2"></param>
public
void
RemoveWall
(
Floor
floor1
,
Floor
floor2
)
{
Vector2
wallPos
=
(
Vector2
)(
floor1
.
MapPos
+
floor2
.
M
apPos
)
/
2
;
Vector2
wallPos
=
(
Vector2
)(
floor1
.
mapPos
+
floor2
.
m
apPos
)
/
2
;
if
(
wallGrid
.
ContainsKey
(
wallPos
))
{
Destroy
(
wallGrid
[
wallPos
].
gameObject
);
...
...
@@ -179,16 +180,31 @@ public class Map : MonoBehaviour
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
}
else
Debug
.
Log
(
"Wall doesn't exists between : "
+
floor1
.
MapPos
+
", "
+
floor2
.
MapPos
);
Debug
.
Log
(
"Wall doesn't exists between : "
+
floor1
.
mapPos
+
", "
+
floor2
.
mapPos
);
}
private
void
LoadObjects
()
{
Debug
.
Log
(
floors
.
transform
.
childCount
);
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
);
}
}
private
void
Awake
()
{
floorGrid
=
new
Dictionary
<
Vector2Int
,
Floor
>();
wallGrid
=
new
Dictionary
<
Vector2
,
Wall
>();
//LoadObjects();
maxMapSize
=
5
*
Mathf
.
Max
(
testInputSizeX
,
testInputSizeY
);
CreateFloor
(
new
Vector2Int
(
0
,
0
),
new
Vector2Int
(
9
,
9
));
CreateWall
(
GetFloorAtPos
(
0
,
2
),
GetFloorAtPos
(
0
,
3
),
Vector2
.
right
,
5
);
MapManager
.
inst
.
surface
.
BuildNavMesh
();
}
...
...
Assets/Scripts/Map/Wall.cs
View file @
bc050b1c
...
...
@@ -7,11 +7,11 @@ public class Wall : MonoBehaviour
/// <summary>
/// Position of this floor at the map.
/// </summary>
public
Vector2
MapPos
{
get
;
private
set
;
}
public
Vector2
mapPos
;
public
void
Set
M
apPos
(
Vector2
pos
)
public
void
Set
m
apPos
(
Vector2
pos
)
{
M
apPos
=
pos
;
m
apPos
=
pos
;
}
// Start is called before the first frame update
...
...
Assets/Scripts/MapManager.cs
View file @
bc050b1c
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEditor
;
using
UnityEngine.AI
;
public
class
MapManager
:
SingletonBehaviour
<
MapManager
>
...
...
@@ -14,19 +15,37 @@ public class MapManager : SingletonBehaviour<MapManager>
public
void
LoadMap
(
Map
_newMap
)
{
if
(
currentMap
!=
null
)
Destroy
(
currentMap
.
gameObject
);
currentMap
=
Instantiate
(
_newMap
);
currentMap
.
transform
.
position
=
new
Vector3
(
0
,
0
,
0
);
player
.
transform
.
position
=
currentMap
.
GetFloorAtPos
(
0
,
0
)
.
transform
.
position
+
new
Vector3
(
0
,
1.5f
,
0
);
player
.
transform
.
position
=
currentMap
.
startFloor
.
transform
.
position
+
new
Vector3
(
0
,
1.5f
,
0
);
}
public
IEnumerator
Rebaker
()
{
yield
return
null
;
surface
.
BuildNavMesh
();
}
/// <summary>
/// Saves map to Assets folder.
/// </summary>
/// <param name="_newMap"></param>
public
void
SaveMap
(
Map
_newMap
)
{
System
.
DateTime
time
=
System
.
DateTime
.
Now
;
string
localPath
=
"Assets/SavedMap_"
+
time
.
ToShortDateString
()
+
"-"
+
time
.
Hour
+
"-"
+
time
.
Minute
+
"-"
+
time
.
Second
+
".prefab"
;
if
(
AssetDatabase
.
LoadAssetAtPath
(
localPath
,
typeof
(
GameObject
)))
Debug
.
Log
(
"Object with same name already exists."
);
else
{
PrefabUtility
.
SaveAsPrefabAsset
(
_newMap
.
gameObject
,
localPath
);
Debug
.
Log
(
"Map saved at "
+
localPath
);
}
}
private
void
Awake
()
{
player
=
GameObject
.
Find
(
"Player"
);
}
// Start is called before the first frame update
...
...
Assets/Scripts/PlayerController.cs
View file @
bc050b1c
...
...
@@ -21,7 +21,7 @@ public class PlayerController : MonoBehaviour
if
(
Physics
.
Raycast
(
mouseRay
,
out
hit
)
&&
hit
.
collider
.
gameObject
.
tag
.
Equals
(
"floor"
))
{
GetComponent
<
NavMeshAgent
>().
SetDestination
(
hit
.
collider
.
gameObject
.
transform
.
position
);
Debug
.
Log
(
hit
.
collider
.
gameObject
.
GetComponent
<
Floor
>().
M
apPos
);
Debug
.
Log
(
hit
.
collider
.
gameObject
.
GetComponent
<
Floor
>().
m
apPos
);
Debug
.
Log
(
hit
.
collider
.
gameObject
.
tag
);
}
}
...
...
Assets/Scripts/TestTools.cs
View file @
bc050b1c
...
...
@@ -30,6 +30,15 @@ public class TestTools : MonoBehaviour
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
int
.
Parse
(
wall2XInput
.
text
),
int
.
Parse
(
wall2YInput
.
text
)));
}
public
void
SaveMap
()
{
MapManager
.
inst
.
SaveMap
(
MapManager
.
inst
.
currentMap
);
}
public
void
LoadMap
()
{
MapManager
.
inst
.
LoadMap
(
MapManager
.
inst
.
stage
[
1
]);
}
// Start is called before the first frame update
void
Start
()
{
...
...
Assets/TestStage.prefab
0 → 100644
View file @
bc050b1c
This diff is collapsed.
Click to expand it.
Assets/
Data
.meta
→
Assets/
TestStage.prefab
.meta
View file @
bc050b1c
fileFormatVersion: 2
guid: f6226b2548447a54486acfc694a44e4d
folderAsset: yes
DefaultImporter:
guid: 20fb0f72e3df40c488f15711aa30ac6e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
...
...
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