effects system
This commit is contained in:
parent
93e7d28de4
commit
cc1fdd44a4
4 changed files with 30 additions and 4 deletions
21
base/scripts/effects_system/effect_handler.gd
Normal file
21
base/scripts/effects_system/effect_handler.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
extends Node
|
||||
|
||||
signal effect_added(effect : StringName)
|
||||
signal effect_removed(effect : StringName)
|
||||
|
||||
## Add effect to
|
||||
func add_effect(effectScene : PackedScene):
|
||||
var effect = effectScene.instantiate()
|
||||
effect.owner = owner
|
||||
if get_node(effect.name) != null:
|
||||
remove_effect(effect.name)
|
||||
add_child(effect)
|
||||
effect_added.emit(effect.name)
|
||||
|
||||
func remove_effect(effect : StringName):
|
||||
var path = NodePath(effect)
|
||||
if get_node(path) == null:
|
||||
printerr("Effect does not exist: ", effect)
|
||||
return
|
||||
effect_removed.emit(effect)
|
||||
get_node(path).queue_free()
|
1
base/scripts/effects_system/effect_handler.gd.uid
Normal file
1
base/scripts/effects_system/effect_handler.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://c8ngo2rpuroum
|
|
@ -1,4 +1,4 @@
|
|||
extends Node3D
|
||||
extends Node
|
||||
|
||||
## Base class for all hp-based objects
|
||||
class_name Entity
|
||||
|
@ -68,8 +68,6 @@ func kill(source : Entity):
|
|||
context.target = self
|
||||
killed.emit(context)
|
||||
GameSignalBus.entity_killed.emit(context)
|
||||
|
||||
deconstruct()
|
||||
|
||||
|
||||
## Method used to properly deconstruct entity
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue