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
3a7a09f4
Commit
3a7a09f4
authored
Feb 03, 2019
by
15김민규
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
죽었을 때 아이템 드랍. 일단 전부 활로.
parent
c0e7fe7f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
23 deletions
+113
-23
Goblin.prefab
Assets/Prefabs/Characters/Enemy/Goblin.prefab
+3
-3
testEnemy.unity
Assets/Scenes/testEnemy.unity
+80
-0
Enemy.cs
Assets/Scripts/Characters/Enemy.cs
+29
-2
EnemyManager.cs
Assets/Scripts/Characters/EnemyManager.cs
+1
-1
EnemyMelee.cs
Assets/Scripts/Characters/EnemyMelee.cs
+0
-6
EnemyMelee.cs.meta
Assets/Scripts/Characters/EnemyMelee.cs.meta
+0
-11
No files found.
Assets/Prefabs/Characters/Enemy/Goblin.prefab
View file @
3a7a09f4
...
@@ -21,7 +21,7 @@ GameObject:
...
@@ -21,7 +21,7 @@ GameObject:
-
component
:
{
fileID
:
4015301101001556
}
-
component
:
{
fileID
:
4015301101001556
}
-
component
:
{
fileID
:
212540714587432698
}
-
component
:
{
fileID
:
212540714587432698
}
-
component
:
{
fileID
:
95413729269184064
}
-
component
:
{
fileID
:
95413729269184064
}
-
component
:
{
fileID
:
1141
38317320723260
}
-
component
:
{
fileID
:
1141
18738857420128
}
m_Layer
:
0
m_Layer
:
0
m_Name
:
Body
m_Name
:
Body
m_TagString
:
Untagged
m_TagString
:
Untagged
...
@@ -193,7 +193,7 @@ Animator:
...
@@ -193,7 +193,7 @@ Animator:
m_HasTransformHierarchy
:
1
m_HasTransformHierarchy
:
1
m_AllowConstantClipSamplingOptimization
:
1
m_AllowConstantClipSamplingOptimization
:
1
m_KeepAnimatorControllerStateOnDisable
:
0
m_KeepAnimatorControllerStateOnDisable
:
0
---
!u!114
&1141
38317320723260
---
!u!114
&1141
18738857420128
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_CorrespondingSourceObject
:
{
fileID
:
0
}
...
@@ -201,7 +201,7 @@ MonoBehaviour:
...
@@ -201,7 +201,7 @@ MonoBehaviour:
m_GameObject
:
{
fileID
:
1225288737757304
}
m_GameObject
:
{
fileID
:
1225288737757304
}
m_Enabled
:
1
m_Enabled
:
1
m_EditorHideFlags
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
f12bf401d26646a488bc32ca7e3845be
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
2d73d07fdab522c4aa045e1cb6a92e8c
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
monsterID
:
101
monsterID
:
101
...
...
Assets/Scenes/testEnemy.unity
View file @
3a7a09f4
...
@@ -757,6 +757,86 @@ Prefab:
...
@@ -757,6 +757,86 @@ Prefab:
propertyPath
:
dropTableData
propertyPath
:
dropTableData
value
:
value
:
objectReference
:
{
fileID
:
4900000
,
guid
:
6216895c658a2af40890a4446cc10a8c
,
type
:
3
}
objectReference
:
{
fileID
:
4900000
,
guid
:
6216895c658a2af40890a4446cc10a8c
,
type
:
3
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[1]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[2]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[3]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[4]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[5]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[6]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[7]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[8]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[9]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[10]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[11]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[12]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[13]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[14]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[15]
value
:
Bow
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
114768470604838176
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
propertyPath
:
dropItemList.Array.data[0]
value
:
Bow
objectReference
:
{
fileID
:
0
}
m_RemovedComponents
:
[]
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
54c1a7b414e41724197333a9e17dd49b
,
type
:
2
}
m_IsPrefabAsset
:
0
m_IsPrefabAsset
:
0
...
...
Assets/Scripts/Characters/Enemy.cs
View file @
3a7a09f4
...
@@ -43,19 +43,25 @@ public class Enemy : MonoBehaviour {
...
@@ -43,19 +43,25 @@ public class Enemy : MonoBehaviour {
private
Animator
animator
;
private
Animator
animator
;
// drop item
// drop item
private
InventoryManager
inventoryManager
;
private
int
[]
dropTable
;
// for test
public
GameObject
droppedItem
;
public
Item
item
;
// method
// method
// Standard Method
// Standard Method
private
void
Awake
()
private
void
Awake
()
{
{
enemyManager
=
EnemyManager
.
Instance
;
enemyManager
=
EnemyManager
.
Instance
;
inventoryManager
=
GameObject
.
Find
(
"InventoryManager"
).
GetComponent
<
InventoryManager
>();
animator
=
GetComponent
<
Animator
>();
animator
=
GetComponent
<
Animator
>();
}
}
private
void
Start
()
private
void
Start
()
{
{
this
.
currHealth
=
maxHealth
;
this
.
currHealth
=
maxHealth
;
dropTable
=
enemyManager
.
dropTableByID
[
monsterID
];
}
}
private
void
Update
()
private
void
Update
()
...
@@ -67,13 +73,34 @@ public class Enemy : MonoBehaviour {
...
@@ -67,13 +73,34 @@ public class Enemy : MonoBehaviour {
public
void
GetDamaged
(
float
damage
)
{
public
void
GetDamaged
(
float
damage
)
{
currHealth
-=
damage
;
currHealth
-=
damage
;
if
(
currHealth
<=
0
)
{
if
(
currHealth
<=
0
)
{
gameObject
.
SetActive
(
false
);
processDeath
(
);
return
;
return
;
}
}
animator
.
SetFloat
(
"knockbackDistance"
,
damage
/
this
.
weight
);
animator
.
SetFloat
(
"knockbackDistance"
,
damage
/
this
.
weight
);
animator
.
SetTrigger
(
"DamagedTrigger"
);
animator
.
SetTrigger
(
"DamagedTrigger"
);
}
}
private
void
processDeath
()
{
float
denominator
=
dropTable
[
dropTable
.
Length
-
1
];
float
numerator
=
Random
.
Range
(
0
,
denominator
);
int
indexOfItem
=
0
;
for
(
int
i
=
0
;
i
<
dropTable
.
Length
;
i
++)
{
if
(
numerator
<=
dropTable
[
i
])
{
indexOfItem
=
i
;
break
;
}
}
inventoryManager
.
ItemInstantiate
(
enemyManager
.
dropItemList
[
indexOfItem
],
transform
.
parent
.
position
);
gameObject
.
SetActive
(
false
);
// animator.SetTrigger("DeadTrigger");
return
;
}
IEnumerator
DebuffCase
(
EnemyDebuffed
sCase
)
IEnumerator
DebuffCase
(
EnemyDebuffed
sCase
)
{
{
...
...
Assets/Scripts/Characters/EnemyManager.cs
View file @
3a7a09f4
...
@@ -17,7 +17,7 @@ public class EnemyManager : Singleton<EnemyManager>
...
@@ -17,7 +17,7 @@ public class EnemyManager : Singleton<EnemyManager>
// data of drop item
// data of drop item
public
TextAsset
dropTableData
;
public
TextAsset
dropTableData
;
public
Dictionary
<
int
,
int
[
]>
dropTableByID
=
new
Dictionary
<
int
,
int
[
]>
();
public
Dictionary
<
int
,
int
[
]>
dropTableByID
=
new
Dictionary
<
int
,
int
[
]>
();
public
GameObject
[]
dropItemList
;
// insert drop item here(on right order)
public
string
[]
dropItemList
;
// insert drop item here(on right order)
// enemy prefab
// enemy prefab
public
GameObject
[]
enemyPrefab
;
public
GameObject
[]
enemyPrefab
;
...
...
Assets/Scripts/Characters/EnemyMelee.cs
deleted
100644 → 0
View file @
c0e7fe7f
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
EnemyMelee
:
Enemy
{
}
Assets/Scripts/Characters/EnemyMelee.cs.meta
deleted
100644 → 0
View file @
c0e7fe7f
fileFormatVersion: 2
guid: f12bf401d26646a488bc32ca7e3845be
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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