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
6e8b713f
Commit
6e8b713f
authored
Jun 23, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
승리 조건 판정 모두 구현함
parent
543c1c41
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
33 deletions
+64
-33
Player3Test.prefab
Assets/Player3Test.prefab
+3
-3
Briefcase.cs
Assets/Scripts/Interactors/Briefcase.cs
+3
-9
CameraTurret.cs
Assets/Scripts/Interactors/CameraTurret.cs
+6
-2
Mannequin.cs
Assets/Scripts/Interactors/Mannequin.cs
+15
-2
ClearCondition.cs
Assets/Scripts/Map/ClearCondition.cs
+16
-12
Floor.cs
Assets/Scripts/Map/Floor.cs
+0
-1
Map.cs
Assets/Scripts/Map/Map.cs
+21
-4
No files found.
Assets/Player3Test.prefab
View file @
6e8b713f
...
...
@@ -381,10 +381,10 @@ MonoBehaviour:
clearConditions
:
-
type
:
0
count
:
0
goal
:
3
-
type
:
3
goal
:
2
-
type
:
7
count
:
0
goal
:
3
goal
:
1
---
!u!1
&2104754727029010325
GameObject
:
m_ObjectHideFlags
:
0
...
...
Assets/Scripts/Interactors/Briefcase.cs
View file @
6e8b713f
...
...
@@ -20,7 +20,7 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
public
void
Init
(
Floor
floor
)
{
if
(
GameManager
.
aCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
goal
++
;
if
(
GameManager
.
aCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
IsDone
(
0
,
1
)
;
this
.
floor
=
floor
;
PlayerController
.
inst
.
OnPlayerMove
+=
Interact
;
}
...
...
@@ -31,15 +31,9 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
if
(
Position
==
position
)
{
if
(
GameManager
.
aCase
>=
0
)
{
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
count
++;
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
IsDone
();
}
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
IsDone
(
1
);
if
(
GameManager
.
nCase
>=
0
)
{
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nCase
].
count
++;
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nCase
].
IsDone
();
}
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nCase
].
IsDone
(
1
);
Destroy
(
gameObject
);
}
}
...
...
Assets/Scripts/Interactors/CameraTurret.cs
View file @
6e8b713f
...
...
@@ -16,6 +16,10 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
public
void
Break
()
{
if
(
GameManager
.
aTurret
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aTurret
].
IsDone
(
1
);
if
(
GameManager
.
nTurret
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nTurret
].
IsDone
(
1
);
Destroy
(
gameObject
);
}
...
...
Assets/Scripts/Interactors/Mannequin.cs
View file @
6e8b713f
...
...
@@ -41,13 +41,22 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
public
void
Interact
(
Bullet
bullet
)
{
if
(
bullet
is
TruthBullet
)
Color
tempColor
=
Color
;
if
(
bullet
is
TruthBullet
&&
tempColor
==
Color
.
black
)
{
Color
=
Color
.
white
;
if
(
GameManager
.
white
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
white
].
IsDone
(
1
);
if
(
GameManager
.
black
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
black
].
IsDone
(-
1
);
}
if
(
bullet
is
FakeBullet
)
else
if
(
bullet
is
FakeBullet
&&
tempColor
==
Color
.
white
)
{
Color
=
Color
.
black
;
if
(
GameManager
.
black
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
black
].
IsDone
(
1
);
if
(
GameManager
.
white
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
white
].
IsDone
(-
1
);
}
}
...
...
@@ -60,6 +69,10 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
public
void
SetColor
(
bool
isWhite
)
{
Color
=
isWhite
?
Color
.
white
:
Color
.
black
;
if
(
GameManager
.
white
>=
0
&&
isWhite
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
white
].
IsDone
(
1
);
if
(
GameManager
.
black
>=
0
&&
!
isWhite
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
black
].
IsDone
(
1
);
}
#
region
IObject
Override
...
...
Assets/Scripts/Map/ClearCondition.cs
View file @
6e8b713f
...
...
@@ -23,25 +23,29 @@ public class ClearCondition
public
int
goal
;
bool
isDone
=
false
;
public
ClearCondition
(
ClearType
_type
,
int
_goal
)
/*
public ClearCondition(ClearType _type, int _goal)
{
type = _type;
goal = _goal;
count = 0;
}
}
*/
public
void
IsDone
()
{
if
(!
isDone
)
public
void
IsDone
(
int
_count
=
0
,
int
_goal
=
0
)
{
count
+=
_count
;
goal
+=
_goal
;
if
(
goal
<=
count
)
{
GameManager
.
inst
.
clearCounter
--;
GameManager
.
inst
.
clearIndex
[(
int
)
type
]
=
-
1
;
isDone
=
true
;
Debug
.
Log
(
GameManager
.
inst
.
clearCounter
);
if
(
GameManager
.
inst
.
clearCounter
==
0
)
GameManager
.
inst
.
ClearStage
();
}
else
if
(
goal
>
count
&&
isDone
)
{
GameManager
.
inst
.
clearCounter
++;
isDone
=
false
;
}
}
}
Assets/Scripts/Map/Floor.cs
View file @
6e8b713f
...
...
@@ -8,7 +8,6 @@ public class Floor : MonoBehaviour
/// Position of this floor at the map.
/// </summary>
public
Vector2Int
mapPos
;
public
bool
isPassed
;
public
bool
isGoalFloor
=
false
;
// Start is called before the first frame update
...
...
Assets/Scripts/Map/Map.cs
View file @
6e8b713f
...
...
@@ -48,7 +48,7 @@ public class Map : MonoBehaviour
/// Create floor at position.
/// </summary>
/// <param name="pos">Position of floor.</param>
public
void
CreateFloor
(
Vector2Int
pos
)
public
void
CreateFloor
(
Vector2Int
pos
,
bool
isGoal
=
false
)
{
if
((
pos
.
x
>=
0
?
(
pos
.
x
>
maxMapSize
/
2
)
:
(
pos
.
x
<
-
maxMapSize
/
2
))
||
(
pos
.
y
>=
0
?
(
pos
.
y
>
maxMapSize
/
2
)
:
(
pos
.
y
<
-
maxMapSize
/
2
)))
{
...
...
@@ -59,9 +59,9 @@ public class Map : MonoBehaviour
{
floorGrid
.
Add
(
pos
,
Instantiate
(
MapManager
.
inst
.
floor
,
new
Vector3
(
pos
.
x
,
0
,
pos
.
y
),
Quaternion
.
identity
,
floors
.
transform
).
GetComponent
<
Floor
>());
floorGrid
[
pos
].
mapPos
=
pos
;
floorGrid
[
pos
].
is
Passed
=
false
;
if
(
GameManager
.
aFloor
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aFloor
].
goal
++
;
floorGrid
[
pos
].
is
GoalFloor
=
isGoal
;
if
(
GameManager
.
aFloor
>=
0
&&
isGoal
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aFloor
].
IsDone
(
0
,
1
)
;
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
}
else
...
...
@@ -95,6 +95,8 @@ public class Map : MonoBehaviour
}
if
(
floorGrid
.
ContainsKey
(
pos
))
{
if
(
GameManager
.
aFloor
>=
0
&&
floorGrid
[
pos
].
isGoalFloor
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aFloor
].
IsDone
(
0
,
-
1
);
Destroy
(
floorGrid
[
pos
].
gameObject
);
floorGrid
.
Remove
(
pos
);
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
...
...
@@ -216,9 +218,13 @@ public class Map : MonoBehaviour
{
case
ObjType
.
Briefcase
:
objectGrid
.
Add
(
pos
,
Instantiate
(
MapManager
.
inst
.
briefCase
,
new
Vector3
(
pos
.
x
,
0
,
pos
.
y
),
Quaternion
.
identity
,
objects
.
transform
).
GetComponent
<
IObject
>());
if
(
GameManager
.
aCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
IsDone
(
0
,
1
);
break
;
case
ObjType
.
Camera
:
objectGrid
.
Add
(
pos
,
Instantiate
(
MapManager
.
inst
.
cameraTurret
,
new
Vector3
(
pos
.
x
,
0
,
pos
.
y
),
Quaternion
.
identity
,
objects
.
transform
).
GetComponent
<
IObject
>());
if
(
GameManager
.
aTurret
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aTurret
].
IsDone
(
0
,
1
);
break
;
case
ObjType
.
Mannequin
:
objectGrid
.
Add
(
pos
,
Instantiate
(
MapManager
.
inst
.
mannequins
[
Random
.
Range
(
0
,
5
)],
new
Vector3
(
pos
.
x
,
0
,
pos
.
y
),
Quaternion
.
identity
,
objects
.
transform
).
GetComponent
<
IObject
>());
...
...
@@ -239,6 +245,17 @@ public class Map : MonoBehaviour
{
if
(
objectGrid
.
ContainsKey
(
pos
))
{
if
(
objectGrid
[
pos
].
GetType
()
==
ObjType
.
Briefcase
&&
GameManager
.
aCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
IsDone
(
0
,
-
1
);
else
if
(
objectGrid
[
pos
].
GetType
()
==
ObjType
.
Camera
&&
GameManager
.
aTurret
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aTurret
].
IsDone
(
0
,
-
1
);
else
if
(
objectGrid
[
pos
].
GetType
()
==
ObjType
.
Mannequin
)
{
if
(
objectGrid
[
pos
].
GetObject
().
GetComponent
<
Mannequin
>().
Color
==
Color
.
white
&&
GameManager
.
white
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
white
].
IsDone
(
0
,
-
1
);
else
if
(
objectGrid
[
pos
].
GetObject
().
GetComponent
<
Mannequin
>().
Color
==
Color
.
black
&&
GameManager
.
black
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
black
].
IsDone
(
0
,
-
1
);
}
Destroy
(
objectGrid
[
pos
].
GetObject
());
objectGrid
.
Remove
(
pos
);
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
...
...
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