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
169ed9bf
Commit
169ed9bf
authored
May 24, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
오브젝트 생성 기능 구현
parent
3637db00
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
19 deletions
+87
-19
jackson.controller
Assets/Models/Animation/jackson.controller
+3
-3
MapManager.prefab
Assets/Prefabs/MapManager.prefab
+6
-2
camera.prefab
Assets/Prefabs/Objects/camera.prefab
+4
-2
Mannequin.cs
Assets/Scripts/Interactors/Mannequin.cs
+1
-1
Map.cs
Assets/Scripts/Map/Map.cs
+60
-7
MapManager.cs
Assets/Scripts/MapManager.cs
+1
-0
Player.cs
Assets/Scripts/Player.cs
+1
-1
TestTools.cs
Assets/Scripts/TestTools.cs
+11
-3
No files found.
Assets/Models/Animation/jackson.controller
View file @
169ed9bf
...
...
@@ -66,19 +66,19 @@ AnimatorController:
m_DefaultFloat
:
0
m_DefaultInt
:
0
m_DefaultBool
:
0
m_Controller
:
{
fileID
:
0
}
m_Controller
:
{
fileID
:
910000
0
}
-
m_Name
:
shoot
m_Type
:
9
m_DefaultFloat
:
0
m_DefaultInt
:
0
m_DefaultBool
:
0
m_Controller
:
{
fileID
:
0
}
m_Controller
:
{
fileID
:
910000
0
}
-
m_Name
:
isShooting
m_Type
:
4
m_DefaultFloat
:
0
m_DefaultInt
:
0
m_DefaultBool
:
0
m_Controller
:
{
fileID
:
0
}
m_Controller
:
{
fileID
:
910000
0
}
m_AnimatorLayers
:
-
serializedVersion
:
5
m_Name
:
Base Layer
...
...
Assets/Prefabs/MapManager.prefab
View file @
169ed9bf
...
...
@@ -48,9 +48,13 @@ MonoBehaviour:
normalWall
:
{
fileID
:
2953616027608884528
,
guid
:
a4dcd71ec9f819f4e88c7b5ac24f4b0d
,
type
:
3
}
mirror
:
{
fileID
:
17874052963739924
,
guid
:
90282f1c82fff7545962b5ca66f1a102
,
type
:
3
}
objects
:
-
{
fileID
:
2534561534465535505
,
guid
:
0b323beb318071144aef94132be66541
,
type
:
3
}
-
{
fileID
:
6001025753464815805
,
guid
:
df6f1d8b9377ec346af4255abe290fbb
,
type
:
3
}
-
{
fileID
:
33432975985984805
,
guid
:
ec20e06c4a993924791d02d7a4c9375c
,
type
:
3
}
players
:
[]
player
:
{
fileID
:
8862060874303168220
,
guid
:
6ba287375b5ad4b458a7b7b99c6d6a0
8
,
type
:
3
}
player
:
{
fileID
:
494213313239918027
,
guid
:
449b2ca4d925da541bb45c84b63aab9
8
,
type
:
3
}
currentMap
:
{
fileID
:
0
}
surface
:
{
fileID
:
0
}
stage
:
-
{
fileID
:
7116745361094357555
,
guid
:
32ff564f49869bf40a53d07394eb081b
,
type
:
3
}
-
{
fileID
:
2496973653136699540
,
guid
:
dbb2e09c19fe5ad49b11a6b95e5ac9e8
,
type
:
3
}
Assets/Prefabs/Objects/camera.prefab
View file @
169ed9bf
...
...
@@ -26,7 +26,7 @@ Transform:
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
6001025753464815801
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
.3
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
6001025753464593565
}
...
...
@@ -65,6 +65,7 @@ MeshRenderer:
m_ProbeAnchor
:
{
fileID
:
0
}
m_LightProbeVolumeOverride
:
{
fileID
:
0
}
m_ScaleInLightmap
:
1
m_ReceiveGI
:
1
m_PreserveUVs
:
0
m_IgnoreNormalsForChartDetection
:
0
m_ImportantGI
:
0
...
...
@@ -155,7 +156,7 @@ Transform:
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
6001025753464815807
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
.3
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
6001025753464593565
}
...
...
@@ -195,6 +196,7 @@ MeshRenderer:
m_ProbeAnchor
:
{
fileID
:
0
}
m_LightProbeVolumeOverride
:
{
fileID
:
0
}
m_ScaleInLightmap
:
1
m_ReceiveGI
:
1
m_PreserveUVs
:
0
m_IgnoreNormalsForChartDetection
:
0
m_ImportantGI
:
0
...
...
Assets/Scripts/Interactors/Mannequin.cs
View file @
169ed9bf
...
...
@@ -43,7 +43,7 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
Color
=
Color
.
black
;
}
}
public
void
Init
(
bool
isWhite
)
{
Color
=
isWhite
?
Color
.
white
:
Color
.
black
;
...
...
Assets/Scripts/Map/Map.cs
View file @
169ed9bf
...
...
@@ -22,11 +22,6 @@ public class Map : MonoBehaviour
/// <returns></returns>
public
Floor
GetFloorAtPos
(
Vector2Int
pos
)
{
if
((
pos
.
x
>=
0
?
(
pos
.
x
>
maxMapSize
/
2
)
:
(
pos
.
x
<
-
maxMapSize
/
2
))
||
(
pos
.
y
>=
0
?
(
pos
.
y
>
maxMapSize
/
2
)
:
(
pos
.
y
<
-
maxMapSize
/
2
)))
{
Debug
.
Log
(
"Input size exceeds map's max size."
);
return
null
;
}
return
floorGrid
.
ContainsKey
(
pos
)
?
floorGrid
[
pos
]
:
null
;
}
/// <summary>
...
...
@@ -39,6 +34,15 @@ public class Map : MonoBehaviour
return
wallGrid
.
ContainsKey
(
pos
)
?
wallGrid
[
pos
]
:
null
;
}
/// <summary>
/// Get object at position.
/// </summary>
/// <param name="pos">Position of object.</param>
/// <returns></returns>
public
IObject
GetObjectAtPos
(
Vector2Int
pos
)
{
return
objectGrid
.
ContainsKey
(
pos
)
?
objectGrid
[
pos
]
:
null
;
}
/// <summary>
/// Create floor at position.
/// </summary>
/// <param name="pos">Position of floor.</param>
...
...
@@ -97,7 +101,7 @@ public class Map : MonoBehaviour
/// Create wall at position.
/// </summary>
/// <param name="pos">Position of wall.</param>
/// <param name="wallType">Type of wall
s
.</param>
/// <param name="wallType">Type of wall.</param>
public
void
CreateWall
(
Vector2
pos
,
WallType
wallType
)
{
if
(((
int
)
pos
.
x
>=
0
?
((
int
)
pos
.
x
>
maxMapSize
/
2
)
:
((
int
)
pos
.
x
<
-
maxMapSize
/
2
))
||
((
int
)
pos
.
y
>=
0
?
((
int
)
pos
.
y
>
maxMapSize
/
2
)
:
((
int
)
pos
.
y
<
-
maxMapSize
/
2
)))
...
...
@@ -158,6 +162,54 @@ public class Map : MonoBehaviour
else
Debug
.
Log
(
"Wall doesn't exists between : "
+
pos
);
}
/// <summary>
/// Create object at position.
/// </summary>
/// <param name="pos">Position of object.</param>
/// <param name="objType">Type of object.</param>
public
void
CreateObject
(
Vector2Int
pos
,
ObjType
objType
)
{
if
((
pos
.
x
>=
0
?
(
pos
.
x
>
maxMapSize
/
2
)
:
(
pos
.
x
<
-
maxMapSize
/
2
))
||
(
pos
.
y
>=
0
?
(
pos
.
y
>
maxMapSize
/
2
)
:
(
pos
.
y
<
-
maxMapSize
/
2
)))
{
Debug
.
Log
(
"Input size exceeds map's max size."
);
return
;
}
if
(!
objectGrid
.
ContainsKey
(
pos
))
{
objectGrid
.
Add
(
pos
,
Instantiate
(
MapManager
.
inst
.
objects
[(
int
)
objType
-
1
],
new
Vector3
(
pos
.
x
,
0
,
pos
.
y
),
Quaternion
.
identity
,
objects
.
transform
).
GetComponent
<
IObject
>());
switch
(
objType
)
{
case
ObjType
.
Briefcase
:
objectGrid
[
pos
].
GetObject
().
GetComponent
<
Briefcase
>().
Init
(
GetFloorAtPos
(
pos
));
return
;
case
ObjType
.
Camera
:
objectGrid
[
pos
].
GetObject
().
GetComponent
<
CameraTurret
>().
Init
(
GetFloorAtPos
(
pos
));
return
;
//Need to make mannequin init
/*case ObjType.Mannequin:
objectGrid[pos].GetObject().GetComponent<Mannequin>().Init(GetFloorAtPos(pos));
return;*/
}
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
}
else
Debug
.
Log
(
"Object already exists at : ("
+
pos
.
x
+
", "
+
pos
.
y
+
")"
);
}
/// <summary>
/// Remove Object at position.
/// </summary>
/// <param name="pos">Position of object.</param>
public
void
RemoveObject
(
Vector2Int
pos
)
{
if
(
objectGrid
.
ContainsKey
(
pos
))
{
Destroy
(
objectGrid
[
pos
].
GetObject
());
objectGrid
.
Remove
(
pos
);
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
}
else
Debug
.
Log
(
"Object doesn't exists between : "
+
pos
);
}
private
void
LoadObjects
()
{
...
...
@@ -185,6 +237,7 @@ public class Map : MonoBehaviour
{
floorGrid
=
new
Dictionary
<
Vector2Int
,
Floor
>();
wallGrid
=
new
Dictionary
<
Vector2
,
Wall
>();
objectGrid
=
new
Dictionary
<
Vector2Int
,
IObject
>();
startFloors
=
new
List
<
Floor
>();
}
...
...
@@ -196,7 +249,7 @@ public class Map : MonoBehaviour
// Start is called before the first frame update
void
Start
()
{
Debug
.
Log
((-
0.5
*
10
)
%
10
);
}
// Update is called once per frame
...
...
Assets/Scripts/MapManager.cs
View file @
169ed9bf
...
...
@@ -10,6 +10,7 @@ public class MapManager : SingletonBehaviour<MapManager>
public
Floor
floor
;
public
NormalWall
normalWall
;
public
Mirror
mirror
;
public
GameObject
[]
objects
;
public
List
<
GameObject
>
players
;
public
GameObject
player
;
public
Map
currentMap
;
...
...
Assets/Scripts/Player.cs
View file @
169ed9bf
...
...
@@ -84,7 +84,7 @@ public class Player : MonoBehaviour
{
float
time
=
Time
.
time
;
float
endTime
=
startTime
+
2
;
while
(
time
<=
endTime
)
while
(
time
<=
endTime
)
{
yield
return
null
;
time
=
Time
.
time
;
...
...
Assets/Scripts/TestTools.cs
View file @
169ed9bf
...
...
@@ -9,7 +9,7 @@ public class TestTools : MonoBehaviour
public
InputField
wallXInput
,
wallYInput
;
/*
public void AddFloor()
public
void
AddFloor
()
{
MapManager
.
inst
.
currentMap
.
CreateFloor
(
new
Vector2Int
(
int
.
Parse
(
floorXInput
.
text
),
int
.
Parse
(
floorYInput
.
text
)));
}
...
...
@@ -19,12 +19,20 @@ public class TestTools : MonoBehaviour
}
public
void
AddWall
()
{
MapManager.inst.currentMap.CreateWall(new Vector2(float.Parse(wallXInput.text), float.Parse(wallYInput.text)));
MapManager
.
inst
.
currentMap
.
CreateWall
(
new
Vector2
(
float
.
Parse
(
wallXInput
.
text
),
float
.
Parse
(
wallYInput
.
text
))
,
WallType
.
Normal
);
}
public
void
RemoveWall
()
{
MapManager
.
inst
.
currentMap
.
RemoveWall
(
new
Vector2
(
float
.
Parse
(
wallXInput
.
text
),
float
.
Parse
(
wallYInput
.
text
)));
}
public
void
AddTurret
()
{
MapManager
.
inst
.
currentMap
.
CreateObject
(
new
Vector2Int
(
int
.
Parse
(
floorXInput
.
text
),
int
.
Parse
(
floorYInput
.
text
)),
ObjType
.
Camera
);
}
public
void
RemoveTurret
()
{
MapManager
.
inst
.
currentMap
.
RemoveObject
(
new
Vector2Int
(
int
.
Parse
(
floorXInput
.
text
),
int
.
Parse
(
floorYInput
.
text
)));
}
public
void
SaveMap
()
{
...
...
@@ -33,7 +41,7 @@ public class TestTools : MonoBehaviour
public
void
LoadMap
()
{
MapManager
.
inst
.
LoadMap
(
MapManager
.
inst
.
stage
[
1
]);
}
*/
}
// Start is called before the first frame update
void
Start
()
...
...
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