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
79f1cca0
Commit
79f1cca0
authored
Jul 02, 2019
by
18신대성
Committed by
18손재민
Jul 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
거울 로직 다 바꾸긴함. 근데 영향 안받는부분 안바뀌게 하려면 또 어느정도 바꿔야함
parent
6f0aa517
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
186 additions
and
82 deletions
+186
-82
2019-07-02-13-21-35.json
Assets/2019-07-02-13-21-35.json
+1
-0
2019-07-02-13-21-35.json.meta
Assets/2019-07-02-13-21-35.json.meta
+2
-3
Floor.cs
Assets/Scripts/Map/Floor.cs
+0
-2
Mirror.cs
Assets/Scripts/Map/Mirror.cs
+183
-77
No files found.
Assets/2019-07-02-13-21-35.json
0 → 100644
View file @
79f1cca0
{
"objects"
:[{
"tag"
:
0
,
"xPos"
:
20.0
,
"yPos"
:
0.0
},{
"tag"
:
2
,
"xPos"
:
-2.0
,
"yPos"
:
-0.5
},{
"tag"
:
2
,
"xPos"
:
-1.0
,
"yPos"
:
-0.5
},{
"tag"
:
2
,
"xPos"
:
0.5
,
"yPos"
:
-1.0
},{
"tag"
:
3
,
"xPos"
:
0.0
,
"yPos"
:
-0.5
},{
"tag"
:
3
,
"xPos"
:
1.0
,
"yPos"
:
-0.5
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
0.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
-1.0
},{
"tag"
:
1
,
"xPos"
:
1.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
0.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
-1.0
,
"yPos"
:
-2.0
},{
"tag"
:
1
,
"xPos"
:
-2.0
,
"yPos"
:
-2.0
},{
"tag"
:
4
,
"xPos"
:
-2.0
,
"yPos"
:
-2.0
},{
"tag"
:
5
,
"xPos"
:
1.0
,
"yPos"
:
-2.0
},{
"tag"
:
6
,
"xPos"
:
1.0
,
"yPos"
:
-1.0
}],
"clears"
:[{
"type"
:
6
,
"goal"
:
1
}],
"bullets"
:[
1
,
1
]}
\ No newline at end of file
Assets/
Maps
.meta
→
Assets/
2019-07-02-13-21-35.json
.meta
View file @
79f1cca0
fileFormatVersion: 2
guid: 47baf9abe59c90a4d914127b0527c24f
folderAsset: yes
DefaultImporter:
guid: 32ee0c564afd5274e887a0d0ff2e4ef5
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
...
...
Assets/Scripts/Map/Floor.cs
View file @
79f1cca0
...
...
@@ -11,8 +11,6 @@ public class Floor : MonoBehaviour
public
bool
isGoalFloor
=
false
;
public
IObject
objOnFloor
=
null
;
public
int
copyCounter
=
0
;
// count for mirror copy
// Start is called before the first frame update
void
Start
()
{
...
...
Assets/Scripts/Map/Mirror.cs
View file @
79f1cca0
...
...
@@ -66,26 +66,57 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
Dictionary
<
Vector2Int
,
Floor
>
copyFloorGrid
=
new
Dictionary
<
Vector2Int
,
Floor
>(
MapManager
.
inst
.
currentMap
.
floorGrid
);
Dictionary
<
Vector2Int
,
int
>
floorCountGrid
=
new
Dictionary
<
Vector2Int
,
int
>();
foreach
(
var
floor
in
copyFloorGrid
)
{
floorCountGrid
.
Add
(
floor
.
Key
,
0
);
}
Dictionary
<
Vector2Int
,
IObject
>
copyObjGrid
=
new
Dictionary
<
Vector2Int
,
IObject
>(
MapManager
.
inst
.
currentMap
.
objectGrid
);
Dictionary
<
Vector2
,
Wall
>
copyWallGrid
=
new
Dictionary
<
Vector2
,
Wall
>(
MapManager
.
inst
.
currentMap
.
wallGrid
);
List
<
GameObject
>
copyPlayers
=
new
List
<
GameObject
>(
MapManager
.
inst
.
players
);
List
<
Pair
>
copyParRay
=
new
List
<
Pair
>(
parRay
);
// remove backside of mirror
for
(
int
j
=
iBack
;
Mathf
.
Abs
(
j
)
<
MapManager
.
inst
.
currentMap
.
maxMapSize
;
j
-=
side
)
{
//Debug.Log(j);
foreach
(
var
obj
in
copyObjGrid
)
float
rangeL
=
j
-
0.25f
*
side
;
float
rangeR
=
j
+
0.25f
*
side
;
foreach
(
var
wall
in
copyWallGrid
)
{
float
wallPos
=
(
dir
?
wall
.
Key
.
y
:
wall
.
Key
.
x
);
if
(
wall
.
Value
.
GetInstanceID
()
!=
GetInstanceID
()
&&
(
side
<
0
?
wallPos
<
rangeL
&&
wallPos
>
rangeR
:
wallPos
>
rangeL
&&
wallPos
<
rangeR
))
{
Pair
pair
=
new
Pair
(
PointToParRay
(
stPos
,
wall
.
Value
.
ldPos
,
false
),
PointToParRay
(
stPos
,
wall
.
Value
.
rdPos
,
false
));
if
(
pair
.
l
>
pair
.
r
)
pair
.
Swap
();
if
(
IsInRay
(
copyParRay
,
pair
))
{
/*remove wall*/
MapManager
.
inst
.
currentMap
.
RemoveWall
(
wall
.
Key
);
SubtractRay
(
copyParRay
,
pair
);
yield
return
null
;
}
}
}
rangeL
=
j
-
0.25f
*
side
+
0.5f
;
rangeR
=
j
+
0.25f
*
side
+
0.5f
;
foreach
(
var
wall
in
copyWallGrid
)
{
if
((
dir
?
obj
.
Key
.
y
:
obj
.
Key
.
x
)
==
j
)
float
wallPos
=
(
dir
?
wall
.
Key
.
y
:
wall
.
Key
.
x
);
if
(
wall
.
Value
.
GetInstanceID
()
!=
GetInstanceID
()
&&
(
side
<
0
?
wallPos
<
rangeL
&&
wallPos
>
rangeR
:
wallPos
>
rangeL
&&
wallPos
<
rangeR
))
{
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
obj
.
Key
,
false
)))
Pair
pair
=
new
Pair
(
PointToParRay
(
stPos
,
wall
.
Value
.
ldPos
,
false
),
PointToParRay
(
stPos
,
wall
.
Value
.
rdPos
,
false
));
if
(
pair
.
l
>
pair
.
r
)
pair
.
Swap
();
if
(
IsInRay
(
copyParRay
,
pair
))
{
/*remove object*/
MapManager
.
inst
.
currentMap
.
RemoveObject
(
obj
.
Key
);
/*remove wall*/
MapManager
.
inst
.
currentMap
.
RemoveWall
(
wall
.
Key
);
SubtractRay
(
copyParRay
,
pair
);
yield
return
null
;
}
}
}
//Debug.Log(i + "th Wall End");
foreach
(
var
ply
in
copyPlayers
)
{
if
(
ply
)
...
...
@@ -94,7 +125,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
if
((
dir
?
plyFloor
.
mapPos
.
y
:
plyFloor
.
mapPos
.
x
)
==
j
)
{
if
(
IsInRay
(
p
arRay
,
PointToParRay
(
stPos
,
plyFloor
.
mapPos
,
false
)))
if
(
IsInRay
(
copyP
arRay
,
PointToParRay
(
stPos
,
plyFloor
.
mapPos
,
false
)))
{
/*remove player*/
PlayerController
.
inst
.
RemovePlayer
(
plyFloor
.
mapPos
);
...
...
@@ -104,59 +135,102 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
}
//Debug.Log(i + "th Object End");
foreach
(
var
floor
in
copyFloorGrid
)
float
range
=
j
-
0.5f
*
side
;
float
minMap
=
-
1
*
MapManager
.
inst
.
currentMap
.
maxMapSize
/
2
-
1.5f
;
float
maxMap
=
MapManager
.
inst
.
currentMap
.
maxMapSize
/
2
+
1.5f
;
//Debug.Log("value: " + minMap + ", " + maxMap);
for
(
float
k
=
minMap
;
k
<
maxMap
;
k
+=
1
)
{
if
((
dir
?
floor
.
Key
.
y
:
floor
.
Key
.
x
)
==
j
)
Vector2
point
=
dir
?
new
Vector2
(
k
,
range
)
:
new
Vector2
(
range
,
k
);
if
(
IsInRay
(
copyParRay
,
PointToParRay
(
stPos
,
point
,
false
)))
{
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
floor
.
Key
,
false
)))
Debug
.
Log
(
"inside "
+
point
+
", "
);
// 사방의 바닥 카피, 그 위의 오브젝트도 카피
Floor
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
FloorToInt
(
point
.
x
),
Mathf
.
FloorToInt
(
point
.
y
));
if
(
floor
!=
null
)
{
/*remove floor*/
MapManager
.
inst
.
currentMap
.
RemoveFloor
(
floor
.
Key
);
yield
return
null
;
Debug
.
Log
(
floor
.
mapPos
);
if
(
IsInRay
(
copyParRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
false
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
RemoveObject
(
floor
.
mapPos
);
Debug
.
Log
(
"remove "
+
floor
.
mapPos
);
MapManager
.
inst
.
currentMap
.
RemoveFloor
(
floor
.
mapPos
);
yield
return
null
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
}
}
//Debug.Log(i + "th Floor End");
float
rangeL
=
j
-
0.25f
*
side
;
float
rangeR
=
j
+
0.25f
*
side
;
foreach
(
var
wall
in
copyWallGrid
)
{
float
wallPos
=
(
dir
?
wall
.
Key
.
y
:
wall
.
Key
.
x
);
if
(
wall
.
Value
.
GetInstanceID
()
!=
GetInstanceID
()
&&
(
side
<
0
?
wallPos
<
rangeL
&&
wallPos
>
rangeR
:
wallPos
>
rangeL
&&
wallPos
<
rangeR
))
{
Pair
pair
=
new
Pair
(
PointToParRay
(
stPos
,
wall
.
Value
.
ldPos
,
false
),
PointToParRay
(
stPos
,
wall
.
Value
.
rdPos
,
false
));
if
(
pair
.
l
>
pair
.
r
)
pair
.
Swap
();
if
(
IsInRay
(
parRay
,
pair
))
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
FloorToInt
(
point
.
x
),
Mathf
.
CeilToInt
(
point
.
y
));
if
(
floor
!=
null
)
{
/*remove wall*/
MapManager
.
inst
.
currentMap
.
RemoveWall
(
wall
.
Key
);
yield
return
null
;
Debug
.
Log
(
floor
.
mapPos
);
if
(
IsInRay
(
copyParRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
false
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
RemoveObject
(
floor
.
mapPos
);
Debug
.
Log
(
"remove "
+
floor
.
mapPos
);
MapManager
.
inst
.
currentMap
.
RemoveFloor
(
floor
.
mapPos
);
yield
return
null
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
}
}
rangeL
=
j
-
0.25f
*
side
+
0.5f
;
rangeR
=
j
+
0.25f
*
side
+
0.5f
;
foreach
(
var
wall
in
copyWallGrid
)
{
float
wallPos
=
(
dir
?
wall
.
Key
.
y
:
wall
.
Key
.
x
);
if
(
wall
.
Value
.
GetInstanceID
()
!=
GetInstanceID
()
&&
(
side
<
0
?
wallPos
<
rangeL
&&
wallPos
>
rangeR
:
wallPos
>
rangeL
&&
wallPos
<
rangeR
))
{
Pair
pair
=
new
Pair
(
PointToParRay
(
stPos
,
wall
.
Value
.
ldPos
,
false
),
PointToParRay
(
stPos
,
wall
.
Value
.
rdPos
,
false
));
if
(
pair
.
l
>
pair
.
r
)
pair
.
Swap
();
if
(
IsInRay
(
parRay
,
pair
))
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
CeilToInt
(
point
.
x
),
Mathf
.
FloorToInt
(
point
.
y
));
if
(
floor
!=
null
)
{
/*remove wall*/
MapManager
.
inst
.
currentMap
.
RemoveWall
(
wall
.
Key
);
yield
return
null
;
Debug
.
Log
(
floor
.
mapPos
);
if
(
IsInRay
(
copyParRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
false
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
RemoveObject
(
floor
.
mapPos
);
Debug
.
Log
(
"remove "
+
floor
.
mapPos
);
MapManager
.
inst
.
currentMap
.
RemoveFloor
(
floor
.
mapPos
);
yield
return
null
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
CeilToInt
(
point
.
x
),
Mathf
.
CeilToInt
(
point
.
y
));
if
(
floor
!=
null
)
{
Debug
.
Log
(
floor
.
mapPos
);
if
(
IsInRay
(
copyParRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
false
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
if
(
floor
.
objOnFloor
!=
null
)
MapManager
.
inst
.
currentMap
.
RemoveObject
(
floor
.
mapPos
);
Debug
.
Log
(
"remove "
+
floor
.
mapPos
);
MapManager
.
inst
.
currentMap
.
RemoveFloor
(
floor
.
mapPos
);
yield
return
null
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
}
}
//Debug.Log(i + "th
Wall
End");
//Debug.Log(i + "th
Floor
End");
}
yield
return
new
WaitForSeconds
(
3f
);
copyFloorGrid
=
new
Dictionary
<
Vector2Int
,
Floor
>(
MapManager
.
inst
.
currentMap
.
floorGrid
);
floorCountGrid
=
new
Dictionary
<
Vector2Int
,
int
>();
foreach
(
var
floor
in
copyFloorGrid
)
{
floorCountGrid
.
Add
(
floor
.
Key
,
0
);
}
copyObjGrid
=
new
Dictionary
<
Vector2Int
,
IObject
>(
MapManager
.
inst
.
currentMap
.
objectGrid
);
copyWallGrid
=
new
Dictionary
<
Vector2
,
Wall
>(
MapManager
.
inst
.
currentMap
.
wallGrid
);
copyPlayers
=
new
List
<
GameObject
>(
MapManager
.
inst
.
players
);
...
...
@@ -207,7 +281,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
}
}
Debug
.
Log
(
i
+
"th Wall End"
);
//
Debug.Log(i + "th Wall End");
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
;
...
...
@@ -217,55 +291,87 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
Vector2
point
=
dir
?
new
Vector2
(
j
,
range
)
:
new
Vector2
(
range
,
j
);
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
point
,
true
)))
{
Debug
.
Log
(
"inside "
+
point
);
//
Debug.Log("inside " + point);
// 사방의 바닥 카피, 그 위의 오브젝트도 카피
Floor
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
FloorToInt
(
point
.
x
),
Mathf
.
FloorToInt
(
point
.
y
));
Debug
.
Log
(
floor
);
//
Debug.Log(floor);
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
;
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
true
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
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
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
FloorToInt
(
point
.
x
),
Mathf
.
CeilToInt
(
point
.
y
));
Debug
.
Log
(
floor
);
//
Debug.Log(floor);
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
;
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
true
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
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
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
CeilToInt
(
point
.
x
),
Mathf
.
FloorToInt
(
point
.
y
));
Debug
.
Log
(
floor
);
//
Debug.Log(floor);
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
;
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
true
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
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
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
floor
=
MapManager
.
inst
.
currentMap
.
GetFloorAtPos
(
Mathf
.
CeilToInt
(
point
.
x
),
Mathf
.
CeilToInt
(
point
.
y
));
Debug
.
Log
(
floor
);
//
Debug.Log(floor);
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
;
if
(
IsInRay
(
parRay
,
PointToParRay
(
stPos
,
floor
.
mapPos
,
true
)))
{
floorCountGrid
[
floor
.
mapPos
]
=
1
;
}
if
(
floorCountGrid
[
floor
.
mapPos
]
==
1
)
{
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
;
}
floorCountGrid
[
floor
.
mapPos
]++;
}
}
}
Debug
.
Log
(
i
+
"th Floor End"
);
//
Debug.Log(i + "th Floor End");
foreach
(
var
ply
in
copyPlayers
)
{
Floor
plyFloor
=
ply
.
GetComponent
<
Player
>().
currentFloor
;
...
...
@@ -354,7 +460,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
bool
output
=
false
;
foreach
(
Pair
pair
in
_parRay
)
{
Debug
.
Log
(
"IsinRay ("
+
pair
.
l
+
", "
+
pair
.
r
+
") "
+
_range
.
l
+
", "
+
_range
.
r
);
//
Debug.Log("IsinRay (" + pair.l + ", " + pair.r + ") " + _range.l + ", " + _range.r);
if
(
pair
.
r
<=
_range
.
l
||
pair
.
l
>=
_range
.
r
)
continue
;
else
{
...
...
@@ -369,7 +475,7 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
{
foreach
(
Pair
pair
in
_parRay
)
{
Debug
.
Log
(
"IsinRay ("
+
pair
.
l
+
", "
+
pair
.
r
+
") "
+
_obj
);
//
Debug.Log("IsinRay (" + pair.l + ", " + pair.r + ") " + _obj);
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