mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 23:54:23 +00:00
Do not track the MonsterType
in SacrificeStone
, so that a monster can have multiple
It's not a big performance cost anyways
This commit is contained in:
parent
a7f00b222d
commit
c606f6b95f
1 changed files with 2 additions and 5 deletions
|
@ -7,7 +7,6 @@ signal sacrifice_changed(entity: PhysicsBody2D, type: Enums.MonsterType)
|
||||||
|
|
||||||
|
|
||||||
var current_monster: PhysicsBody2D
|
var current_monster: PhysicsBody2D
|
||||||
var current_type: Enums.MonsterType = Enums.MonsterType.None
|
|
||||||
|
|
||||||
|
|
||||||
func _on_tracked(body: PhysicsBody2D):
|
func _on_tracked(body: PhysicsBody2D):
|
||||||
|
@ -18,12 +17,10 @@ func _on_tracked(body: PhysicsBody2D):
|
||||||
var types: Array = body.find_children("*", "Sacrificable", false, false)
|
var types: Array = body.find_children("*", "Sacrificable", false, false)
|
||||||
for type in types:
|
for type in types:
|
||||||
current_monster = body
|
current_monster = body
|
||||||
current_type = type.type
|
sacrifice_changed.emit(current_monster)
|
||||||
sacrifice_changed.emit(current_monster, current_type)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
func _on_untracked(body: PhysicsBody2D):
|
func _on_untracked(body: PhysicsBody2D):
|
||||||
if body == current_monster:
|
if body == current_monster:
|
||||||
current_monster = null
|
current_monster = null
|
||||||
current_type = Enums.MonsterType.None
|
sacrifice_changed.emit(current_monster)
|
||||||
sacrifice_changed.emit(current_monster, current_type)
|
|
||||||
|
|
Loading…
Reference in a new issue