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
078c1d2a
Commit
078c1d2a
authored
May 13, 2019
by
18신대성
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
일반벽과 거울을 Wall 클래스에 종속시킴
parent
daf752cb
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
25 deletions
+17
-25
Mirror.cs
Assets/Scripts/Interactors/Mirror.cs
+1
-22
NormalWall.cs
Assets/Scripts/Interactors/NormalWall.cs
+6
-2
GameManager.cs
Assets/Scripts/Managers/GameManager.cs
+1
-0
Wall.cs
Assets/Scripts/Map/Wall.cs
+9
-1
No files found.
Assets/Scripts/Interactors/Mirror.cs
View file @
078c1d2a
...
...
@@ -3,29 +3,8 @@ using System.Collections.Generic;
using
UnityEngine
;
using
UnityEngine.AI
;
public
class
Mirror
:
MonoBehaviour
,
IBulletInteractor
,
IBreakable
public
class
Mirror
:
Wall
,
IBulletInteractor
,
IBreakable
{
public
Vector2
mapPos
;
// data about this mirror
public
Vector2Int
ldPos
// left down pos
{
get
{
return
new
Vector2Int
((
int
)
mapPos
.
x
,
(
int
)
mapPos
.
y
);
}
}
public
Vector2Int
rdPos
// right down pos
{
get
{
return
ldPos
+
(
dir
?
new
Vector2Int
(
1
,
0
)
:
new
Vector2Int
(
0
,
1
));
}
}
public
bool
dir
// false: ver, true: hor
{
get
{
return
(
int
)(
transform
.
rotation
.
eulerAngles
.
y
/
90
)
%
2
!=
1
;
}
}
private
int
len
=
1
;
// length of mirror
public
void
SetmapPos
(
Vector2
pos
)
{
mapPos
=
pos
;
}
public
void
Break
()
{
Destroy
(
gameObject
);
...
...
Assets/Scripts/Interactors/NormalWall.cs
View file @
078c1d2a
...
...
@@ -2,7 +2,7 @@
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
NormalWall
:
MonoBehaviour
,
IBulletInteractor
public
class
NormalWall
:
Wall
,
IBulletInteractor
{
public
void
Interact
(
Bullet
bullet
)
{
...
...
@@ -12,7 +12,11 @@ public class NormalWall : MonoBehaviour, IBulletInteractor
}
else
if
(
bullet
is
MirrorBullet
)
{
gameObject
.
AddComponent
<
Mirror
>();
Mirror
mirror
=
gameObject
.
AddComponent
<
Mirror
>();
GetComponent
<
Renderer
>().
material
=
GameManager
.
inst
.
mirrorMaterial
;
mirror
.
SetmapPos
(
mapPos
);
mirror
.
len
=
len
;
mirror
.
type
=
WallType
.
Mirror
;
Destroy
(
this
);
}
}
...
...
Assets/Scripts/Managers/GameManager.cs
View file @
078c1d2a
...
...
@@ -5,6 +5,7 @@ using System.Linq;
public
class
GameManager
:
SingletonBehaviour
<
GameManager
>
{
public
Material
mirrorMaterial
;
/*
private List<IPlayerInteractor> playerInteractors;
...
...
Assets/Scripts/Map/Wall.cs
View file @
078c1d2a
...
...
@@ -2,6 +2,13 @@
using
System.Collections.Generic
;
using
UnityEngine
;
public
enum
WallType
{
NULL
,
Normal
,
Mirror
}
public
class
Wall
:
MonoBehaviour
{
/// <summary>
...
...
@@ -14,13 +21,14 @@ public class Wall : MonoBehaviour
}
public
Vector2Int
rdPos
// right down pos
{
get
{
return
ldPos
+
(
dir
?
new
Vector2Int
(
1
,
0
)
:
new
Vector2Int
(
0
,
1
));
}
get
{
return
ldPos
+
(
dir
?
new
Vector2Int
(
len
,
0
)
:
new
Vector2Int
(
0
,
len
));
}
}
public
bool
dir
// false: ver, true: hor
{
get
{
return
(
int
)(
transform
.
rotation
.
eulerAngles
.
y
/
90
)
%
2
!=
1
;
}
}
public
int
len
=
1
;
// length of wall
public
WallType
type
;
public
void
SetmapPos
(
Vector2
pos
)
{
...
...
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