Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
tetra-tower
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Oenos
tetra-tower
Commits
9580cf3a
Commit
9580cf3a
authored
Feb 26, 2019
by
15김민규
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
벽에 낑기는거 해결 완료.
parent
24bf0a24
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
15 deletions
+19
-15
Goblin.prefab
Assets/Prefabs/Characters/Enemy/Goblin.prefab
+2
-4
EnemyManager.prefab
Assets/Prefabs/EnemyManager.prefab
+6
-0
Enemy.cs
Assets/Scripts/Characters/Enemy/Enemy.cs
+2
-2
EnemyGround.cs
Assets/Scripts/Characters/Enemy/EnemyGround.cs
+6
-9
EnemyManager.cs
Assets/Scripts/EnemyManager.cs
+3
-0
No files found.
Assets/Prefabs/Characters/Enemy/Goblin.prefab
View file @
9580cf3a
...
...
@@ -61,7 +61,7 @@ GameObject:
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
0
m_IsActive
:
1
---
!u!1
&1734061800721222
GameObject
:
m_ObjectHideFlags
:
1
...
...
@@ -300,8 +300,6 @@ MonoBehaviour:
knockbackPercentage
:
-
0.5
MovementLock
:
0
bumped
:
0
bumpable
:
1
attackRange
:
1.2
---
!u!114
&114173716467154830
MonoBehaviour
:
...
...
@@ -378,7 +376,7 @@ SpriteRenderer:
m_AutoUVMaxAngle
:
89
m_LightmapParameters
:
{
fileID
:
0
}
m_SortingLayerID
:
-2078941185
m_SortingLayer
:
7
m_SortingLayer
:
8
m_SortingOrder
:
0
m_Sprite
:
{
fileID
:
21300000
,
guid
:
71335108d30aa0e4a90179a09895440e
,
type
:
3
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
...
...
Assets/Prefabs/EnemyManager.prefab
View file @
9580cf3a
...
...
@@ -60,3 +60,9 @@ MonoBehaviour:
-
{
fileID
:
1896221696921858
,
guid
:
6051c7354232afa45bf71a1032a49418
,
type
:
2
}
EnemySpawnCount
:
0
EnemyDeadCount
:
0
layerMaskWall
:
serializedVersion
:
2
m_Bits
:
256
layerMaskPlatform
:
serializedVersion
:
2
m_Bits
:
2304
Assets/Scripts/Characters/Enemy/Enemy.cs
View file @
9580cf3a
...
...
@@ -70,12 +70,12 @@ public class Enemy : MonoBehaviour {
currHealth
=
maxHealth
;
Invisible
=
MovementLock
=
KnockbackLock
=
false
;
if
(
enemyManager
.
DropTableByID
.
ContainsKey
(
monsterID
))
{
dropTable
=
enemyManager
.
DropTableByID
[
monsterID
];
}
PlayerDistance
=
Vector2
.
Distance
(
enemyManager
.
P
layer
.
transform
.
position
,
transform
.
parent
.
position
);
PlayerDistance
=
Vector2
.
Distance
(
GameManager
.
Instance
.
p
layer
.
transform
.
position
,
transform
.
parent
.
position
);
}
protected
virtual
void
FixedUpdate
()
{
PlayerDistance
=
Vector2
.
Distance
(
enemyManager
.
P
layer
.
transform
.
position
,
transform
.
parent
.
position
);
PlayerDistance
=
Vector2
.
Distance
(
GameManager
.
Instance
.
p
layer
.
transform
.
position
,
transform
.
parent
.
position
);
}
// When damaged
...
...
Assets/Scripts/Characters/Enemy/EnemyGround.cs
View file @
9580cf3a
...
...
@@ -8,8 +8,8 @@ public class EnemyGround : Enemy {
public
float
attackRange
;
public
int
MoveDir
{
get
;
private
set
;
}
public
bool
[]
WallTest
{
get
;
private
set
;
}
public
bool
[]
CliffTest
{
get
;
private
set
;
}
public
bool
[]
WallTest
;
public
bool
[]
CliffTest
;
protected
override
void
Awake
()
{
...
...
@@ -38,7 +38,6 @@ public class EnemyGround : Enemy {
// - Check whether enemy is near to cliff
private
void
CheckCliff
()
{
Vector2
velocity
=
transform
.
parent
.
GetComponent
<
Rigidbody2D
>().
velocity
;
Vector2
colliderSize
=
transform
.
parent
.
GetComponent
<
BoxCollider2D
>().
size
;
foreach
(
int
Dir
in
Enum
.
GetValues
(
typeof
(
NumeratedDir
)))
...
...
@@ -46,8 +45,7 @@ public class EnemyGround : Enemy {
Vector2
origin
=
(
Vector2
)
transform
.
parent
.
position
+
Dir
*
new
Vector2
(
colliderSize
.
x
/
2.0f
,
0
);
Vector2
direction
=
Vector2
.
down
;
float
distance
=
colliderSize
.
y
/
4.0f
;
int
layerMask
=
LayerMask
.
NameToLayer
(
"platform"
);
RaycastHit2D
hit
=
Physics2D
.
Raycast
(
origin
,
direction
,
distance
,
layerMask
);
RaycastHit2D
hit
=
Physics2D
.
Raycast
(
origin
,
direction
,
distance
,
enemyManager
.
layerMaskPlatform
);
CliffTest
[(
Dir
+
1
)
/
2
]
=
(
hit
.
collider
==
null
);
}
...
...
@@ -60,11 +58,10 @@ public class EnemyGround : Enemy {
foreach
(
int
Dir
in
Enum
.
GetValues
(
typeof
(
NumeratedDir
)))
{
Vector2
origin
=
(
Vector2
)
transform
.
parent
.
position
+
new
Vector2
(
Dir
*
colliderSize
.
x
/
2.0f
,
colliderSize
.
y
);
Vector2
origin
=
(
Vector2
)
transform
.
parent
.
position
+
new
Vector2
(
Dir
*
colliderSize
.
x
/
2.0f
,
colliderSize
.
y
/
2.0f
);
Vector2
direction
=
Vector2
.
right
*
Dir
;
float
distance
=
0.5f
;
LayerMask
layerMask
=
LayerMask
.
GetMask
(
"Wall"
,
"OuterWall"
);
RaycastHit2D
hit
=
Physics2D
.
Raycast
(
origin
,
direction
,
distance
,
layerMask
);
float
distance
=
0.2f
;
RaycastHit2D
hit
=
Physics2D
.
Raycast
(
origin
,
direction
,
distance
,
enemyManager
.
layerMaskWall
);
WallTest
[(
Dir
+
1
)
/
2
]
=
(
hit
.
collider
!=
null
);
}
...
...
Assets/Scripts/EnemyManager.cs
View file @
9580cf3a
...
...
@@ -33,6 +33,9 @@ public class EnemyManager : Singleton<EnemyManager>
private
uint
EnemySpawnCount
;
public
uint
EnemyDeadCount
;
// wall or platform
public
LayerMask
layerMaskWall
;
public
LayerMask
layerMaskPlatform
;
// method
// Constructor - protect calling raw constructor
...
...
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