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
d5b6c173
Commit
d5b6c173
authored
May 24, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
카메라 감지하는거 적용함
parent
1c531be9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
Vector2IntExtensions.cs
Assets/Scripts/Extensions/Vector2IntExtensions.cs
+4
-7
CameraTurret.cs
Assets/Scripts/Interactors/CameraTurret.cs
+2
-2
PlayerController.cs
Assets/Scripts/PlayerController.cs
+6
-3
No files found.
Assets/Scripts/Extensions/Vector2IntExtensions.cs
View file @
d5b6c173
...
...
@@ -4,13 +4,10 @@ using UnityEngine;
public
static
class
Vector2IntExtensions
{
public
static
bool
IsInSquareArea
(
this
Vector2Int
a
,
Vector2Int
b
,
int
size
)
{
bool
xdiff
=
Mathf
.
Abs
(
a
.
x
-
b
.
x
)
<=
size
;
bool
ydiff
=
Mathf
.
Abs
(
a
.
y
-
b
.
y
)
<=
size
;
return
(
xdiff
&&
!
ydiff
)
||
(!
xdiff
&&
ydiff
);
}
public
static
bool
IsInAdjacentArea
(
this
Vector2Int
a
,
Vector2Int
b
,
int
size
)
{
return
(
a
-
b
).
magnitude
<=
size
;
}
public
static
int
ManhattanDistance
(
this
Vector2Int
a
,
Vector2Int
b
)
{
return
Mathf
.
Abs
(
a
.
x
-
b
.
x
)
+
Mathf
.
Abs
(
a
.
y
-
b
.
y
);
...
...
Assets/Scripts/Interactors/CameraTurret.cs
View file @
d5b6c173
...
...
@@ -21,9 +21,9 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
public
void
Interact
(
Vector2Int
pos
)
{
if
(
Position
.
IsIn
Square
Area
(
pos
,
1
))
if
(
Position
.
IsIn
Adjacent
Area
(
pos
,
1
))
{
Debug
.
Log
(
"
Stage Restart!"
);
Debug
.
Log
(
Position
.
x
+
" "
+
Position
.
y
+
"
Stage Restart!"
);
//TODO : Restart Level
}
}
...
...
Assets/Scripts/PlayerController.cs
View file @
d5b6c173
...
...
@@ -10,14 +10,17 @@ public class PlayerController : SingletonBehaviour<PlayerController>
public
bool
isPlayerMoving
;
public
bool
isPlayerShooting
;
public
bool
isZooming
;
private
Vector2Int
prePos
;
[
SerializeField
]
private
Vector2Int
prePos
;
public
Vector2Int
MapPos
{
get
{
Vector2Int
pos
=
Vector2Int
.
zero
;
pos
.
x
=
Mathf
.
RoundToInt
(
transform
.
position
.
x
);
pos
.
y
=
Mathf
.
RoundToInt
(
transform
.
position
.
y
);
if
(
currentPlayer
)
{
pos
.
x
=
Mathf
.
RoundToInt
(
currentPlayer
.
transform
.
position
.
x
);
pos
.
y
=
Mathf
.
RoundToInt
(
currentPlayer
.
transform
.
position
.
z
);
}
return
pos
;
}
}
...
...
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