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
36a5a80b
Commit
36a5a80b
authored
May 01, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
머지함. 플레이어 이동 중 다른 플레이어 선택 시 발생하는 오류 수정함. 현재 bullet과 관련해서 호출하는 오브젝트가 없어 오류가 있는지 확인할 수가 없음. 나중에 확인할 것
parent
ec3bda99
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
45 deletions
+38
-45
Animation.meta
Assets/Models/Animation.meta
+1
-1
UIs.meta
Assets/Prefabs/UIs.meta
+1
-1
ModelScene.meta
Assets/Scenes/ModelScene.meta
+0
-8
Player.cs
Assets/Scripts/Player.cs
+12
-11
PlayerController.cs
Assets/Scripts/PlayerController.cs
+24
-24
No files found.
Assets/Models/Animation.meta
View file @
36a5a80b
fileFormatVersion: 2
guid:
6aaeac95275fd9142a4a0f13fc71837e
guid:
ac3371a68e3523b4f905d8bfc52f6da4
folderAsset: yes
DefaultImporter:
externalObjects: {}
...
...
Assets/Prefabs/UIs.meta
View file @
36a5a80b
fileFormatVersion: 2
guid:
6aaeac95275fd9142a4a0f13fc71837e
guid:
04b8bdcf5e4a6f041bd8f30be7c4b604
folderAsset: yes
DefaultImporter:
externalObjects: {}
...
...
Assets/Scenes/ModelScene.meta
deleted
100644 → 0
View file @
ec3bda99
fileFormatVersion: 2
guid: a32ca40f7f255ea47ac7ee9d558755ce
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Player.cs
View file @
36a5a80b
...
...
@@ -5,7 +5,7 @@ using UnityEngine.AI;
public
class
Player
:
MonoBehaviour
{
Coroutine
playerArivalCheck
;
Coroutine
playerAr
r
ivalCheck
;
public
IEnumerator
SetCurrentPlayer
()
{
...
...
@@ -23,22 +23,23 @@ public class Player : MonoBehaviour
{
NavMeshAgent
agent
=
GetComponent
<
NavMeshAgent
>();
NavMeshPath
path
=
new
NavMeshPath
();
if
(
playerArivalCheck
!=
null
)
StopCoroutine
(
playerArivalCheck
);
playerArivalCheck
=
StartCoroutine
(
CheckIfPlayerArrived
(
destination
));
agent
.
CalculatePath
(
destination
,
path
);
if
(
playerArrivalCheck
!=
null
)
StopCoroutine
(
playerArrivalCheck
);
PlayerController
.
inst
.
isPlayerMoving
=
true
;
playerArrivalCheck
=
StartCoroutine
(
CheckIfPlayerArrived
(
destination
));
agent
.
CalculatePath
(
destination
,
path
);
if
(
path
.
status
==
NavMeshPathStatus
.
PathComplete
)
GetComponent
<
NavMeshAgent
>().
SetDestination
(
destination
);
else
Debug
.
Log
(
"Destination is not reachable."
);
}
IEnumerator
CheckIfPlayerArrived
(
Vector3
destination
)
{
while
(
transform
.
position
.
x
!=
destination
.
x
||
transform
.
position
.
z
!=
destination
.
z
)
{
yield
return
null
;
PlayerController
.
inst
.
isPlayerMoving
=
true
;
}
{
while
(
Mathf
.
Abs
(
transform
.
position
.
x
-
destination
.
x
)
>
0.001f
||
Mathf
.
Abs
(
transform
.
position
.
z
-
destination
.
z
)
>
0.001f
)
{
yield
return
null
;
}
transform
.
position
=
new
Vector3
(
destination
.
x
,
transform
.
position
.
y
,
destination
.
z
);
PlayerController
.
inst
.
isPlayerMoving
=
false
;
}
// Start is called before the first frame update
...
...
Assets/Scripts/PlayerController.cs
View file @
36a5a80b
...
...
@@ -38,29 +38,29 @@ public class PlayerController : SingletonBehaviour<PlayerController>
prePos
=
MapPos
;
}
if
(
Input
.
GetMouseButtonDown
(
0
)
&&
!
isPlayerMoving
)
{
Ray
mouseRay
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
RaycastHit
hit
;
if
(
Physics
.
Raycast
(
mouseRay
,
out
hit
)
&&
hit
.
collider
.
gameObject
.
tag
.
Equals
(
"Player"
))
{
if
(
currentPlayer
!=
null
)
currentPlayer
.
ResetCurrentPlayer
();
currentPlayer
=
hit
.
transform
.
gameObject
.
GetComponent
<
Player
>();
StartCoroutine
(
currentPlayer
.
SetCurrentPlayer
());
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
);
}
else
if
(
hit
.
collider
==
null
)
{
if
(
currentPlayer
!=
null
)
currentPlayer
.
ResetCurrentPlayer
();
}
}
if
(
Input
.
GetMouseButtonDown
(
0
)
&&
!
isPlayerMoving
)
{
Ray
mouseRay
=
Camera
.
main
.
ScreenPointToRay
(
Input
.
mousePosition
);
RaycastHit
hit
;
if
(
Physics
.
Raycast
(
mouseRay
,
out
hit
)
&&
hit
.
collider
.
gameObject
.
tag
.
Equals
(
"Player"
))
{
if
(
currentPlayer
!=
null
)
currentPlayer
.
ResetCurrentPlayer
();
currentPlayer
=
hit
.
transform
.
gameObject
.
GetComponent
<
Player
>();
StartCoroutine
(
currentPlayer
.
SetCurrentPlayer
());
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
);
}
else
if
(
hit
.
collider
==
null
)
{
if
(
currentPlayer
!=
null
)
currentPlayer
.
ResetCurrentPlayer
();
}
}
}
}
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