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
7622d79c
Commit
7622d79c
authored
May 04, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PointToParRay 함수 완성
parent
25b8aa22
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
Mirror.cs
Assets/Scripts/Interactors/Mirror.cs
+11
-6
No files found.
Assets/Scripts/Interactors/Mirror.cs
View file @
7622d79c
...
...
@@ -129,20 +129,25 @@ public class Mirror : MonoBehaviour, IBulletInteractor, IBreakable
/// <summary>
/// calculate where _chPos is from _stPos
/// </summary>
/// <param name="stPos">position of shooter</param>
/// <param name="chPos">position of object</param>
/// <param name="isRefl">if we calculate after reflecting, true</param>
/// <param name="
_
stPos">position of shooter</param>
/// <param name="
_
chPos">position of object</param>
/// <param name="
_
isRefl">if we calculate after reflecting, true</param>
/// <returns>float value of _chPos is posed</returns>
float
PointToParRay
(
Vector2
_stPos
,
Vector2
_chPos
,
bool
_isRefl
)
{
if
(
dir
)
// horizontal
{
float
dist
=
_chPos
.
y
-
_stPos
.
y
+
(
_isRefl
?
(
pos
.
y
-
_chPos
.
y
)
*
2
:
0
);
float
dist
=
_chPos
.
y
-
_stPos
.
y
+
(
_isRefl
?
(
pos
.
y
-
_chPos
.
y
)
*
2
:
0
);
float
spreadLen
=
len
*
dist
/
(
pos
.
y
-
_stPos
.
y
);
float
rayStPos
=
_stPos
.
x
+
(
pos
.
x
-
_stPos
.
x
)
*
dist
/
(
pos
.
y
-
_stPos
.
y
);
return
(
_chPos
.
x
-
rayStPos
)
/
spreadLen
;
}
// TODO: when dir is vertical
return
0
;
else
// vertical
{
float
dist
=
_chPos
.
x
-
_stPos
.
x
+
(
_isRefl
?
(
pos
.
x
-
_chPos
.
x
)
*
2
:
0
);
float
spreadLen
=
len
*
dist
/
(
pos
.
x
-
_stPos
.
x
);
float
rayStPos
=
_stPos
.
y
+
(
pos
.
y
-
_stPos
.
y
)
*
dist
/
(
pos
.
x
-
_stPos
.
x
);
return
(
_chPos
.
y
-
rayStPos
)
/
spreadLen
;
}
}
}
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