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
efa56abc
Commit
efa56abc
authored
Jul 02, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
반사 로직 다시짜는중 WIP
parent
79b286f6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
21 deletions
+48
-21
Map.cs
Assets/Scripts/Map/Map.cs
+4
-0
Mirror.cs
Assets/Scripts/Map/Mirror.cs
+44
-21
No files found.
Assets/Scripts/Map/Map.cs
View file @
efa56abc
...
...
@@ -27,6 +27,10 @@ public class Map : MonoBehaviour
{
return
floorGrid
.
ContainsKey
(
pos
)
?
floorGrid
[
pos
]
:
null
;
}
public
Floor
GetFloorAtPos
(
int
x
,
int
y
)
{
return
GetFloorAtPos
(
new
Vector2Int
(
x
,
y
));
}
/// <summary>
/// Get floor at position.
/// </summary>
...
...
Assets/Scripts/Map/Mirror.cs
View file @
efa56abc
...
...
@@ -206,35 +206,58 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
}
//Debug.Log(i + "th Wall End");
float
range
=
i
-
0.5f
;
float
range
=
i
+
0.5f
*
side
;
float
minMap
=
-
1
*
MapManager
.
inst
.
currentMap
.
maxMapSize
/
2
-
1.5f
;
float
maxMap
=
MapManager
.
inst
.
currentMap
.
maxMapSize
/
2
+
1.5f
;
for
(
float
j
=
minMap
;
Mathf
.
Abs
(
j
)
<
maxMap
;
j
++)
{
/*
* if ((range, j) is in ray)
* {
* 사방에 있는거 카피, 그위의 오브젝트도 카피
* }
* */
Vector2
point
=
dir
?
new
Vector2
(
j
,
range
)
:
new
Vector2
(
range
,
j
);
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
point
,
true
)))
{
// 사방의 바닥 카피, 그 위의 오브젝트도 카피
Floor
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
FloorToInt
(
point
.
x
),
Mathf
.
FloorToInt
(
point
.
y
));
if
(
floor
!=
null
)
{
int
nextx
=
dir
?
floor
.
mapPos
.
x
:
Mathf
.
RoundToInt
(
2
*
ldPos
.
x
-
floor
.
mapPos
.
x
);
int
nexty
=
dir
?
Mathf
.
RoundToInt
(
2
*
ldPos
.
y
-
floor
.
mapPos
.
y
)
:
floor
.
mapPos
.
y
;
MapManager
.
inst
.
currentMap
.
CreateFloor
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
isGoalFloor
);
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
CreateObject
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
objOnFloor
.
GetType
(),
(
floor
.
objOnFloor
.
GetType
()
!=
ObjType
.
Mannequin
?
true
:
((
Mannequin
)
floor
.
objOnFloor
).
isWhite
));
yield
return
null
;
}
//Debug.Log(i + "th Floor End"
);
foreach
(
var
obj
in
copyObjGrid
)
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
FloorToInt
(
point
.
x
),
Mathf
.
CeilToInt
(
point
.
y
)
);
if
(
floor
!=
null
)
{
if
((
dir
?
obj
.
Key
.
y
:
obj
.
Key
.
x
)
==
i
)
int
nextx
=
dir
?
floor
.
mapPos
.
x
:
Mathf
.
RoundToInt
(
2
*
ldPos
.
x
-
floor
.
mapPos
.
x
);
int
nexty
=
dir
?
Mathf
.
RoundToInt
(
2
*
ldPos
.
y
-
floor
.
mapPos
.
y
)
:
floor
.
mapPos
.
y
;
MapManager
.
inst
.
currentMap
.
CreateFloor
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
isGoalFloor
);
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
CreateObject
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
objOnFloor
.
GetType
(),
(
floor
.
objOnFloor
.
GetType
()
!=
ObjType
.
Mannequin
?
true
:
((
Mannequin
)
floor
.
objOnFloor
).
isWhite
));
yield
return
null
;
}
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
CeilToInt
(
point
.
x
),
Mathf
.
FloorToInt
(
point
.
y
));
if
(
floor
!=
null
)
{
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
obj
.
Key
,
true
)))
int
nextx
=
dir
?
floor
.
mapPos
.
x
:
Mathf
.
RoundToInt
(
2
*
ldPos
.
x
-
floor
.
mapPos
.
x
);
int
nexty
=
dir
?
Mathf
.
RoundToInt
(
2
*
ldPos
.
y
-
floor
.
mapPos
.
y
)
:
floor
.
mapPos
.
y
;
MapManager
.
inst
.
currentMap
.
CreateFloor
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
isGoalFloor
);
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
CreateObject
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
objOnFloor
.
GetType
(),
(
floor
.
objOnFloor
.
GetType
()
!=
ObjType
.
Mannequin
?
true
:
((
Mannequin
)
floor
.
objOnFloor
).
isWhite
));
yield
return
null
;
}
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
CeilToInt
(
point
.
x
),
Mathf
.
CeilToInt
(
point
.
y
));
if
(
floor
!=
null
)
{
/*copy object*/
int
nextx
=
dir
?
obj
.
Key
.
x
:
Mathf
.
RoundToInt
(
2
*
ldPos
.
x
-
obj
.
Key
.
x
);
int
nexty
=
dir
?
Mathf
.
RoundToInt
(
2
*
ldPos
.
y
-
obj
.
Key
.
y
)
:
obj
.
Key
.
y
;
ObjType
type
=
obj
.
Value
.
GetType
();
MapManager
.
inst
.
currentMap
.
CreateObject
(
new
Vector2Int
(
nextx
,
nexty
),
type
,
(
type
==
ObjType
.
Mannequin
?
((
Mannequin
)(
obj
.
Value
)).
isWhite
:
true
));
int
nextx
=
dir
?
floor
.
mapPos
.
x
:
Mathf
.
RoundToInt
(
2
*
ldPos
.
x
-
floor
.
mapPos
.
x
);
int
nexty
=
dir
?
Mathf
.
RoundToInt
(
2
*
ldPos
.
y
-
floor
.
mapPos
.
y
)
:
floor
.
mapPos
.
y
;
MapManager
.
inst
.
currentMap
.
CreateFloor
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
isGoalFloor
);
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
CreateObject
(
new
Vector2Int
(
nextx
,
nexty
),
floor
.
objOnFloor
.
GetType
(),
(
floor
.
objOnFloor
.
GetType
()
!=
ObjType
.
Mannequin
?
true
:
((
Mannequin
)
floor
.
objOnFloor
).
isWhite
));
yield
return
null
;
}
}
}
//Debug.Log(i + "th Floor End");
foreach
(
var
ply
in
copyPlayers
)
{
Floor
plyFloor
=
ply
.
GetComponent
<
Player
>().
currentFloor
;
...
...
@@ -251,7 +274,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
}
}
//Debug.Log(i + "th
Object
End");
//Debug.Log(i + "th
Player
End");
}
MapManager
.
inst
.
currentMap
.
RemoveWall
(
mapPos
);
}
...
...
@@ -337,7 +360,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
{
foreach
(
Pair
pair
in
_parRay
)
{
if
(
pair
.
l
<
=
_obj
&&
pair
.
r
>=
_obj
)
return
true
;
if
(
pair
.
l
<
_obj
&&
pair
.
r
>
_obj
)
return
true
;
}
return
false
;
}
...
...
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