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
88e50fd3
Commit
88e50fd3
authored
Jun 04, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
스테이지 클리어 판정 추가
n개의 목표 바닥 밟기 판정 WIP
parent
b8f25489
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
150 additions
and
53 deletions
+150
-53
Player3Test.prefab
Assets/Player3Test.prefab
+53
-9
GameManager.prefab
Assets/Prefabs/GameManager.prefab
+16
-0
MapManager.prefab
Assets/Prefabs/MapManager.prefab
+6
-6
SampleScene.unity
Assets/Scenes/SampleScene.unity
+5
-5
Briefcase.cs
Assets/Scripts/Interactors/Briefcase.cs
+5
-15
GameManager.cs
Assets/Scripts/Managers/GameManager.cs
+23
-1
ClearCondition.cs
Assets/Scripts/Map/ClearCondition.cs
+12
-6
Floor.cs
Assets/Scripts/Map/Floor.cs
+2
-0
Map.cs
Assets/Scripts/Map/Map.cs
+1
-0
MapManager.cs
Assets/Scripts/MapManager.cs
+5
-4
Player.cs
Assets/Scripts/Player.cs
+9
-4
PlayerController.cs
Assets/Scripts/PlayerController.cs
+13
-3
No files found.
Assets/Player3Test.prefab
View file @
88e50fd3
...
...
@@ -106,6 +106,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
1
,
y
:
0
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&1634709099193762938
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -212,6 +214,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-2
,
y
:
-1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&1638206002697659172
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -318,6 +322,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
1
,
y
:
1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&1737410653383664023
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -375,16 +381,10 @@ MonoBehaviour:
clearConditions
:
-
type
:
0
count
:
0
goal
:
0
-
type
:
0
count
:
0
goal
:
0
-
type
:
0
count
:
0
goal
:
0
-
type
:
0
goal
:
4
-
type
:
3
count
:
0
goal
:
0
goal
:
3
---
!u!1
&2104754727029010325
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -491,6 +491,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
2
,
y
:
0
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&2189700681577347922
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -597,6 +599,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-2
,
y
:
2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&2292282653549884484
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -703,6 +707,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-1
,
y
:
2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&2339437859421285817
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -809,6 +815,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-2
,
y
:
-2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&2681926362236754680
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -915,6 +923,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
2
,
y
:
1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&3525591482656589422
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1021,6 +1031,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
2
,
y
:
-2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&4007647678807291638
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1252,6 +1264,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
1
,
y
:
-2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&4592160369612705167
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1358,6 +1372,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
1
,
y
:
-1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&4709249395185914413
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1464,6 +1480,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
1
,
y
:
2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&4810397660174508062
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1570,6 +1588,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-1
,
y
:
-1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&5069305046428251933
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1676,6 +1696,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-1
,
y
:
0
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&5342110572568681991
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1782,6 +1804,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
0
,
y
:
-2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&5390496715387352304
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -2068,6 +2092,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
0
,
y
:
1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&6532917746544365902
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -2208,6 +2234,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-2
,
y
:
1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&7141810549857698684
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -2314,6 +2342,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
0
,
y
:
0
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&7422189717627061705
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -2545,6 +2575,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-2
,
y
:
0
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&7560450311381198066
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -2806,6 +2838,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-1
,
y
:
1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&8683807963293059402
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -2912,6 +2946,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
0
,
y
:
2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&8695425579486219508
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -3018,6 +3054,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
2
,
y
:
2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&8852115476851130467
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -3124,6 +3162,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
0
,
y
:
-1
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&9046791506793280589
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -3230,6 +3270,8 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
-1
,
y
:
-2
}
isPassed
:
0
isGoalFloor
:
0
---
!u!1
&9206324191454810788
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -3336,3 +3378,5 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
mapPos
:
{
x
:
2
,
y
:
-1
}
isPassed
:
0
isGoalFloor
:
0
Assets/Prefabs/GameManager.prefab
View file @
88e50fd3
...
...
@@ -9,6 +9,7 @@ GameObject:
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
52444459818764335
}
-
component
:
{
fileID
:
2122327709
}
m_Layer
:
0
m_Name
:
GameManager
m_TagString
:
Untagged
...
...
@@ -30,3 +31,18 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&2122327709
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
52444459818764334
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
f94477ce50cfef746baa12d77bb9d4eb
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
mirrorMaterial
:
{
fileID
:
0
}
clearIndex
:
000000000000000000000000000000000000000000000000000000000000000000000000
clearCounter
:
0
Assets/Prefabs/MapManager.prefab
View file @
88e50fd3
...
...
@@ -52,15 +52,15 @@ MonoBehaviour:
-
{
fileID
:
2534561534465535505
,
guid
:
0b323beb318071144aef94132be66541
,
type
:
3
}
-
{
fileID
:
6001025753464815805
,
guid
:
df6f1d8b9377ec346af4255abe290fbb
,
type
:
3
}
-
{
fileID
:
33432975985984805
,
guid
:
ec20e06c4a993924791d02d7a4c9375c
,
type
:
3
}
players
:
[]
player
:
{
fileID
:
494213313239918027
,
guid
:
449b2ca4d925da541bb45c84b63aab98
,
type
:
3
}
currentMap
:
{
fileID
:
0
}
surface
:
{
fileID
:
0
}
stage
:
-
{
fileID
:
2496973653136699540
,
guid
:
dbb2e09c19fe5ad49b11a6b95e5ac9e8
,
type
:
3
}
truthBullet
:
{
fileID
:
7554112578236620015
,
guid
:
bfe2c93abf5421b4a9b142f60d689533
,
type
:
3
}
fakeBullet
:
{
fileID
:
5866539243986221368
,
guid
:
a1830defb592fe841ab1732fd18f73a1
,
type
:
3
}
mirrorBullet
:
{
fileID
:
3200095709359611570
,
guid
:
bb70103aa487bc346a6df423335477a2
,
type
:
3
}
players
:
[]
player
:
{
fileID
:
494213313239918027
,
guid
:
449b2ca4d925da541bb45c84b63aab98
,
type
:
3
}
currentMap
:
{
fileID
:
0
}
surface
:
{
fileID
:
0
}
stage
:
-
{
fileID
:
2496973653136699540
,
guid
:
dbb2e09c19fe5ad49b11a6b95e5ac9e8
,
type
:
3
}
Assets/Scenes/SampleScene.unity
View file @
88e50fd3
...
...
@@ -802,11 +802,6 @@ PrefabInstance:
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
-
target
:
{
fileID
:
7277015661519863741
,
guid
:
20dee07e28273f049a9093ae4453912f
,
type
:
3
}
propertyPath
:
m_NavMeshData
value
:
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
7277015661519863740
,
guid
:
20dee07e28273f049a9093ae4453912f
,
type
:
3
}
propertyPath
:
m_Name
...
...
@@ -817,6 +812,11 @@ PrefabInstance:
propertyPath
:
m_IsActive
value
:
1
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
7277015661519863741
,
guid
:
20dee07e28273f049a9093ae4453912f
,
type
:
3
}
propertyPath
:
m_NavMeshData
value
:
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
7277015661519863742
,
guid
:
20dee07e28273f049a9093ae4453912f
,
type
:
3
}
propertyPath
:
m_LocalPosition.x
...
...
Assets/Scripts/Interactors/Briefcase.cs
View file @
88e50fd3
...
...
@@ -7,8 +7,6 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
[
SerializeField
]
private
Floor
floor
=
null
;
public
Vector2Int
Position
{
get
{
return
floor
!=
null
?
floor
.
mapPos
:
throw
new
UnassignedReferenceException
(
"Floor of Interactor is not assigned"
);
}
}
private
int
aCase
;
private
int
nCase
;
public
GameObject
GetObject
()
{
...
...
@@ -22,9 +20,7 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
public
void
Init
(
Floor
floor
)
{
aCase
=
GameManager
.
inst
.
clearIndex
[(
int
)
ClearType
.
AllCase
];
nCase
=
GameManager
.
inst
.
clearIndex
[(
int
)
ClearType
.
NCase
];
if
(
aCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
aCase
].
goal
++;
if
(
GameManager
.
aCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
goal
++;
this
.
floor
=
floor
;
PlayerController
.
inst
.
OnPlayerMove
+=
Interact
;
}
...
...
@@ -34,16 +30,10 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
Debug
.
Log
(
Position
+
" "
+
position
);
if
(
Position
==
position
)
{
if
(
aCase
>=
0
)
{
MapManager
.
inst
.
currentMap
.
clearConditions
[
aCase
].
count
++;
MapManager
.
inst
.
currentMap
.
clearConditions
[
aCase
].
IsDone
();
}
if
(
nCase
>=
0
)
{
MapManager
.
inst
.
currentMap
.
clearConditions
[
nCase
].
count
++;
MapManager
.
inst
.
currentMap
.
clearConditions
[
nCase
].
IsDone
();
}
if
(
GameManager
.
aCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aCase
].
IsDone
();
if
(
GameManager
.
nCase
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nCase
].
IsDone
();
Destroy
(
gameObject
);
}
}
...
...
Assets/Scripts/Managers/GameManager.cs
View file @
88e50fd3
...
...
@@ -9,8 +9,9 @@ public class GameManager : SingletonBehaviour<GameManager>
public
int
[]
clearIndex
=
new
int
[
9
];
public
int
clearCounter
=
0
;
public
static
int
nFloor
,
nTurret
,
nCase
,
nPlayer
,
aFloor
,
aTurret
,
aCase
,
white
,
black
;
p
rivate
void
G
etClearIndex
(
Map
map
)
p
ublic
void
S
etClearIndex
(
Map
map
)
{
for
(
int
i
=
0
;
i
<
9
;
i
++)
clearIndex
[
i
]
=
-
1
;
foreach
(
var
child
in
map
.
clearConditions
)
...
...
@@ -18,5 +19,26 @@ public class GameManager : SingletonBehaviour<GameManager>
clearIndex
[(
int
)
child
.
type
]
=
map
.
clearConditions
.
IndexOf
(
child
);
clearCounter
++;
}
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
];
}
public
void
ClearStage
()
{
Debug
.
Log
(
"Stage Clear!"
);
}
// Start is called before the first frame update
void
Start
()
{
if
(!
MapManager
.
inst
.
isMapEditingOn
)
MapManager
.
inst
.
LoadMap
(
MapManager
.
inst
.
stage
[
0
]);
}
}
Assets/Scripts/Map/ClearCondition.cs
View file @
88e50fd3
...
...
@@ -21,6 +21,7 @@ public class ClearCondition
public
ClearType
type
;
public
int
count
;
public
int
goal
;
bool
isDone
=
false
;
public
ClearCondition
(
ClearType
_type
,
int
_goal
)
{
...
...
@@ -29,14 +30,19 @@ public class ClearCondition
count
=
0
;
}
public
bool
IsDone
()
public
void
IsDone
()
{
if
(
goal
<=
count
)
if
(
!
isDone
)
{
GameManager
.
inst
.
clearCounter
--;
GameManager
.
inst
.
clearIndex
[(
int
)
type
]
=
-
1
;
return
true
;
count
++;
if
(
goal
<=
count
)
{
GameManager
.
inst
.
clearCounter
--;
GameManager
.
inst
.
clearIndex
[(
int
)
type
]
=
-
1
;
isDone
=
true
;
if
(
GameManager
.
inst
.
clearCounter
==
0
)
GameManager
.
inst
.
ClearStage
();
}
}
else
return
false
;
}
}
Assets/Scripts/Map/Floor.cs
View file @
88e50fd3
...
...
@@ -8,6 +8,8 @@ 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
void
Start
()
...
...
Assets/Scripts/Map/Map.cs
View file @
88e50fd3
...
...
@@ -59,6 +59,7 @@ 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
].
isPassed
=
false
;
StartCoroutine
(
MapManager
.
inst
.
Rebaker
());
}
else
...
...
Assets/Scripts/MapManager.cs
View file @
88e50fd3
...
...
@@ -7,16 +7,17 @@ using UnityEngine.AI;
public
class
MapManager
:
SingletonBehaviour
<
MapManager
>
{
public
bool
isMapEditingOn
;
[
Header
(
"Instances"
)]
public
Floor
floor
;
public
NormalWall
normalWall
;
public
Mirror
mirror
;
public
GameObject
[]
objects
;
public
GameObject
truthBullet
,
fakeBullet
,
mirrorBullet
;
public
List
<
GameObject
>
players
;
public
GameObject
player
;
public
Map
currentMap
;
public
NavMeshSurface
surface
;
public
Map
[]
stage
;
public
GameObject
truthBullet
,
fakeBullet
,
mirrorBullet
;
public
BulletFactory
bulletFactory
;
public
void
LoadMap
(
Map
_newMap
)
...
...
@@ -26,8 +27,9 @@ public class MapManager : SingletonBehaviour<MapManager>
currentMap
=
Instantiate
(
_newMap
);
currentMap
.
transform
.
position
=
new
Vector3
(
0
,
0
,
0
);
surface
.
BuildNavMesh
();
GameManager
.
inst
.
SetClearIndex
(
currentMap
);
for
(
int
i
=
0
;
i
<
currentMap
.
startFloors
.
Count
;
i
++)
players
.
Add
(
Instantiate
(
player
,
currentMap
.
startFloors
[
i
].
transform
.
position
+
new
Vector3
(
0
,
0.1f
,
0
),
Quaternion
.
identity
)
);
PlayerController
.
inst
.
CreatePlayer
(
currentMap
.
startFloors
[
i
].
transform
.
position
);
}
public
IEnumerator
Rebaker
()
{
...
...
@@ -44,8 +46,7 @@ public class MapManager : SingletonBehaviour<MapManager>
// Start is called before the first frame update
void
Start
()
{
if
(!
isMapEditingOn
)
LoadMap
(
stage
[
0
]);
}
// Update is called once per frame
...
...
Assets/Scripts/Player.cs
View file @
88e50fd3
...
...
@@ -55,9 +55,7 @@ public class Player : MonoBehaviour
GetComponent
<
NavMeshAgent
>().
SetDestination
(
destination
);
}
else
{
Debug
.
Log
(
"Destination is not reachable."
);
}
}
/// <summary>
/// Check if player is arrived at the destination.
...
...
@@ -68,10 +66,17 @@ public class Player : MonoBehaviour
{
anim
.
SetBool
(
"isWalking"
,
true
);
while
(
Mathf
.
Abs
(
transform
.
position
.
x
-
destination
.
x
)
>
0.01f
||
Mathf
.
Abs
(
transform
.
position
.
z
-
destination
.
z
)
>
0.01f
)
{
yield
return
null
;
}
transform
.
position
=
new
Vector3
(
destination
.
x
,
transform
.
position
.
y
,
destination
.
z
);
Floor
currentFloor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
new
Vector2Int
((
int
)
destination
.
x
,
(
int
)
destination
.
z
));
if
(!
currentFloor
.
isPassed
)
{
currentFloor
.
isPassed
=
true
;
if
(
GameManager
.
aFloor
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
aFloor
].
IsDone
();
if
(
GameManager
.
nFloor
>=
0
)
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nFloor
].
IsDone
();
}
anim
.
SetBool
(
"isWalking"
,
false
);
PlayerController
.
inst
.
isPlayerMoving
=
false
;
}
...
...
Assets/Scripts/PlayerController.cs
View file @
88e50fd3
...
...
@@ -27,6 +27,16 @@ public class PlayerController : SingletonBehaviour<PlayerController>
public
event
Action
<
Vector2Int
>
OnPlayerMove
;
public
void
CreatePlayer
(
Vector3
playerPos
)
{
MapManager
.
inst
.
players
.
Add
(
Instantiate
(
MapManager
.
inst
.
player
,
playerPos
+
new
Vector3
(
0
,
0.1f
,
0
),
Quaternion
.
identity
));
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nPlayer
].
count
=
MapManager
.
inst
.
players
.
Count
-
1
;
Debug
.
Log
(
MapManager
.
inst
.
players
.
Count
-
1
);
MapManager
.
inst
.
currentMap
.
clearConditions
[
GameManager
.
nPlayer
].
IsDone
();
}
//For test
public
string
GetCurrentBullet
()
{
return
bulletList
.
Count
>
0
?
bulletList
[
bulletCount
].
ToString
()
:
null
;
...
...
@@ -58,7 +68,7 @@ public class PlayerController : SingletonBehaviour<PlayerController>
{
if
(
prePos
!=
MapPos
)
{
Debug
.
Log
(
MapPos
);
//
Debug.Log(MapPos);
OnPlayerMove
?.
Invoke
(
MapPos
);
prePos
=
MapPos
;
}
...
...
@@ -80,13 +90,13 @@ public class PlayerController : SingletonBehaviour<PlayerController>
currentPlayer
=
hit
.
transform
.
gameObject
.
GetComponent
<
Player
>();
StartCoroutine
(
currentPlayer
.
SetCurrentPlayer
());
StartCoroutine
(
currentPlayer
.
CountPlayerClick
(
Time
.
time
));
Debug
.
Log
(
hit
.
collider
.
gameObject
.
tag
);
//
Debug.Log(hit.collider.gameObject.tag);
}
else
if
(
Physics
.
Raycast
(
mouseRay
,
out
hit
)
&&
hit
.
collider
.
gameObject
.
tag
.
Equals
(
"floor"
))
{
if
(
currentPlayer
!=
null
)
currentPlayer
.
MovePlayer
(
hit
.
collider
.
gameObject
.
transform
.
position
);
Debug
.
Log
(
hit
.
collider
.
gameObject
.
tag
);
//
Debug.Log(hit.collider.gameObject.tag);
}
else
if
(
hit
.
collider
==
null
)
{
...
...
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