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
25b8aa22
Commit
25b8aa22
authored
May 04, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SubtractRay 함수 완성
parent
fba076cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
Mirror.cs
Assets/Scripts/Interactors/Mirror.cs
+34
-4
No files found.
Assets/Scripts/Interactors/Mirror.cs
View file @
25b8aa22
...
...
@@ -23,7 +23,7 @@ public class Mirror : MonoBehaviour, IBulletInteractor, IBreakable
if
(
bullet
is
FakeBullet
)
{
// Make reflected objects
CopyObject
(
gameObject
.
transform
);
CopyObject
s
(
gameObject
.
transform
);
}
else
if
(
bullet
is
TruthBullet
)
{
...
...
@@ -46,7 +46,7 @@ public class Mirror : MonoBehaviour, IBulletInteractor, IBreakable
/// copy objects which reflected by this mirror
/// </summary>
/// <param name="_shooter">transform of shooter</param>
private
void
CopyObject
(
Transform
_shooter
)
private
void
CopyObject
s
(
Transform
_shooter
)
{
Vector2Int
stPos
;
// position of shooter's cell
Vector2
rstPos
;
// real position of shooter
...
...
@@ -70,8 +70,38 @@ public class Mirror : MonoBehaviour, IBulletInteractor, IBreakable
{
if
(
pair
.
r
<
_sub
.
l
||
pair
.
l
>
_sub
.
r
)
continue
;
float
[]
arr
=
{
pair
.
l
,
pair
.
r
,
_sub
.
l
,
_sub
.
r
};
// TODO: sort arr
// TODO: _parRay에서 _sub을 뺀다.
for
(
int
i
=
0
;
i
<
4
;
i
++)
// sort arr
{
float
smallest
=
arr
[
i
];
int
smallIdx
=
i
;
for
(
int
j
=
i
+
1
;
j
<
4
;
j
++)
{
if
(
smallest
>
arr
[
j
])
{
smallest
=
arr
[
j
];
smallIdx
=
j
;
}
}
float
temp
=
arr
[
i
];
arr
[
i
]
=
smallest
;
arr
[
smallIdx
]
=
temp
;
}
// subtract
if
(
arr
[
0
]
==
_sub
.
l
&&
arr
[
2
]
==
_sub
.
r
)
{
pair
.
l
=
_sub
.
r
;
}
else
if
(
arr
[
1
]
==
_sub
.
l
&&
arr
[
3
]
==
_sub
.
r
)
{
pair
.
r
=
_sub
.
l
;
}
else
if
(
arr
[
1
]
==
_sub
.
l
&&
arr
[
2
]
==
_sub
.
r
)
{
_parRay
.
Add
(
new
Pair
<
float
,
float
>(
pair
.
r
,
_sub
.
r
));
pair
.
r
=
_sub
.
l
;
}
}
}
...
...
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