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
0f052b1b
Commit
0f052b1b
authored
Jun 19, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
거울 wip
parent
8345d690
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
Mirror.cs
Assets/Scripts/Map/Mirror.cs
+8
-7
No files found.
Assets/Scripts/Map/Mirror.cs
View file @
0f052b1b
...
...
@@ -86,7 +86,8 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
}
}
foreach
(
var
wall
in
MapManager
.
inst
.
currentMap
.
wallGrid
)
Dictionary
<
Vector2
,
Wall
>
copyGrid
=
new
Dictionary
<
Vector2
,
Wall
>(
MapManager
.
inst
.
currentMap
.
wallGrid
);
foreach
(
var
wall
in
copyGrid
)
{
if
((
dir
?
wall
.
Key
.
y
:
wall
.
Key
.
x
)
==
i
)
{
...
...
@@ -97,6 +98,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
float
nextx
=
dir
?
wall
.
Key
.
x
:
2
*
ldPos
.
x
-
wall
.
Key
.
x
;
float
nexty
=
dir
?
2
*
ldPos
.
y
-
wall
.
Key
.
y
:
wall
.
Key
.
y
;
MapManager
.
inst
.
currentMap
.
CreateWall
(
new
Vector2
(
nextx
,
nexty
),
wall
.
Value
.
type
);
Debug
.
Log
(
"created at "
+
nextx
+
", "
+
nexty
);
SubtractRay
(
parRay
,
pair
);
}
...
...
@@ -146,15 +148,16 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
pair
.
r
=
_sub
.
l
;
}
}
for
(
int
i
=
0
;
i
<
_parRay
.
Count
;
i
++)
{
if
(
_parRay
[
i
].
r
-
_parRay
[
i
].
l
<
0.001f
)
_parRay
.
Remove
(
_parRay
[
i
]);
}
Debug
.
Log
(
"Ray count: "
+
_parRay
.
Count
);
foreach
(
var
ray
in
_parRay
)
{
Debug
.
Log
(
"Ray: "
+
ray
.
l
+
"~"
+
ray
.
r
);
}
for
(
int
i
=
0
;
i
<
_parRay
.
Count
;
i
++)
{
if
(
_parRay
[
i
].
r
-
_parRay
[
i
].
l
<
0.001f
)
_parRay
.
Remove
(
_parRay
[
i
]);
}
}
/// <summary>
...
...
@@ -199,13 +202,11 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
if
(
dir
)
{
float
px
=
(
_chPos
.
x
-
_stPos
.
x
)*(
ldPos
.
y
-
_stPos
.
y
)/(
_isRefl
?
2
*
ldPos
.
y
-
_chPos
.
y
-
_stPos
.
y
:
_chPos
.
y
-
_stPos
.
y
)
+
_stPos
.
x
;
Debug
.
Log
(
"PointToParRay x: "
+
(
px
-
ldPos
.
x
)
+
" pos: "
+
_chPos
);
return
px
-
ldPos
.
x
;
}
else
{
float
py
=
(
_chPos
.
y
-
_stPos
.
y
)
*
(
ldPos
.
x
-
_stPos
.
x
)
/
(
_isRefl
?
2
*
ldPos
.
x
-
_chPos
.
x
-
_stPos
.
x
:
_chPos
.
x
-
_stPos
.
x
)
+
_stPos
.
y
;
Debug
.
Log
(
"PointToParRay y: "
+
(
py
-
ldPos
.
y
)
+
" pos: "
+
_chPos
);
return
py
-
ldPos
.
y
;
}
}
...
...
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