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
aed576ba
Commit
aed576ba
authored
Aug 07, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
거울 오류 수정 WIP
parent
9954947b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
Mirror.cs
Assets/Scripts/Map/Mirror.cs
+28
-2
No files found.
Assets/Scripts/Map/Mirror.cs
View file @
aed576ba
...
...
@@ -64,7 +64,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
{
Pair
pair
=
new
Pair
(
PointToParRay
(
stPos
,
wall
.
Value
.
ldPos
,
false
),
PointToParRay
(
stPos
,
wall
.
Value
.
rdPos
,
false
));
if
(
pair
.
l
>
pair
.
r
)
pair
=
pair
.
Swap
();
SubtractRay
(
parRay
,
pair
);
if
(
IsInRay
(
parRay
,
pair
))
SubtractRay
(
parRay
,
pair
);
yield
return
null
;
}
}
...
...
@@ -86,6 +86,11 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
// check after reflect, if obj or floor, copy else if wall or mirror, Subtract
for
(;
Mathf
.
Abs
(
i
)
<
MapManager
.
inst
.
currentMap
.
maxMapSize
;
i
+=
side
)
{
while
(
true
)
{
yield
return
null
;
if
(
Input
.
GetKeyUp
(
KeyCode
.
A
))
break
;
}
for
(
float
j
=
minMap
;
j
<
maxMap
;
j
++)
{
// copy / remove wall
...
...
@@ -111,12 +116,18 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
if
(
IsInRay
(
parRay
,
tempPair
))
MapManager
.
inst
.
currentMap
.
RemoveWall
(
oppWallPos
);
}
}
while
(
true
)
{
yield
return
null
;
if
(
Input
.
GetKeyUp
(
KeyCode
.
A
))
break
;
}
float
iMid
=
i
+
0.5f
*
side
;
for
(
float
j
=
minMap
;
j
<
maxMap
;
j
++)
{
//Debug.Log("iMid:" + iMid + " j:" + j);
// copy / remove wall
Vector2
wallPos
=
dir
?
new
Vector2
(
j
-
0.5f
,
iMid
)
:
new
Vector2
(
iMid
,
j
-
0.5f
);
//Debug.Log(wallPos);
float
nextx
=
dir
?
wallPos
.
x
:
2
*
mapPos
.
x
-
wallPos
.
x
;
float
nexty
=
dir
?
2
*
mapPos
.
y
-
wallPos
.
y
:
wallPos
.
y
;
Vector2
oppWallPos
=
new
Vector2
(
nextx
,
nexty
);
...
...
@@ -139,7 +150,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
// copy / remove floor and object
Vector2
pointPos
=
dir
?
new
Vector2
(
j
,
iMid
)
:
new
Vector2
(
iMid
,
j
);
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
pointPos
,
true
)))
if
(
IsInRay
Weak
(
parRay
,
PointToParRay
(
stPos
,
pointPos
,
true
)))
{
//Debug.Log("inside " + pointPos);
Vector2Int
floorPos
=
new
Vector2Int
(
Mathf
.
FloorToInt
(
pointPos
.
x
),
Mathf
.
FloorToInt
(
pointPos
.
y
));
...
...
@@ -280,6 +291,11 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
}
}
while
(
true
)
{
yield
return
null
;
if
(
Input
.
GetKeyUp
(
KeyCode
.
A
))
break
;
}
}
Break
();
}
...
...
@@ -388,6 +404,16 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
return
output
;
}
bool
IsInRayWeak
(
List
<
Pair
>
_parRay
,
float
_obj
)
{
foreach
(
Pair
pair
in
_parRay
)
{
//Debug.Log("IsinRay (" + pair.l + ", " + pair.r + ") " + _obj);
if
(
pair
.
l
<
_obj
&&
pair
.
r
>
_obj
)
return
true
;
}
return
false
;
}
/// <summary>
/// calculate where _chPos is from _stPos
/// </summary>
...
...
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