Skip to content

Commit 2937dd1

Browse files
committed
unit test
1 parent 6455ae7 commit 2937dd1

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

Samples/EntityExamples.unity

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -709,10 +709,8 @@ MonoBehaviour:
709709
m_EditorClassIdentifier:
710710
itemDrop:
711711
- item: {fileID: 11400000, guid: b27eeae83168bce49ba810731a0200b5, type: 2}
712-
chance: 0
713-
- item: {fileID: 11400000, guid: b27eeae83168bce49ba810731a0200b5, type: 2}
714-
chance: 0
715-
- item: {fileID: 0}
716-
chance: 0
717-
roll: 12
712+
chance: 15
713+
- item: {fileID: 11400000, guid: 93bad3294d8a97445bbf3cc7b821f667, type: 2}
714+
chance: 256
715+
roll: 1
718716
entityToSpawn: {fileID: 4739109322253644523, guid: 0a001269a7880c74bb4ce4d03dd45397, type: 3}

Tests/Runtime/EntityExample.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ public class EntityExample : MonoBehaviour
1010
[SerializeField] int roll = 4;
1111
[SerializeField] Entity entityToSpawn;
1212
List<Entity> entitysOnExample = new List<Entity>();
13+
float lootTableTimer = 0;
1314
private void Update() {
1415
if(BGameInput.Instance.GetKeyPress("Interaction")){
1516
var e = Instantiate(entityToSpawn);
1617
e.transform.position = new Vector2(Random.Range(-13, 13), Random.Range(-8, 8));
1718
e.onDispose += () =>{
1819
entitysOnExample.Remove(e);
1920
};
20-
LootTable.GetDrop(itemDrop[0], roll);
2121
entitysOnExample.Add(e);
2222
}
2323
if(BGameInput.Instance.GetKeyPress("Example")){
@@ -51,5 +51,17 @@ private void Update() {
5151

5252
entitysOnExample[rnd].Kill();
5353
}
54+
55+
LootTableTest();
56+
}
57+
58+
void LootTableTest(){
59+
lootTableTimer += Time.deltaTime;
60+
if(lootTableTimer >= 10f){
61+
foreach(var i in itemDrop){
62+
LootTable.GetDrop(i, roll);
63+
}
64+
lootTableTimer = 0;
65+
}
5466
}
5567
}

0 commit comments

Comments
 (0)