Cleaned and improved some event stuff
This commit is contained in:
@@ -2,15 +2,13 @@ class_name Event extends Node
|
||||
|
||||
const Entity = preload("res://scripts/Entity/Entity.gd");
|
||||
|
||||
var inEventSystemTree:bool = false;
|
||||
var started:bool = false;
|
||||
var ended:bool = false;
|
||||
var interactor:EntityInteractor = null
|
||||
var interactee:EntityInteractable = null
|
||||
|
||||
# Godot Methods
|
||||
func _init() -> void:
|
||||
pass
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if !started || ended:
|
||||
return
|
||||
@@ -21,6 +19,11 @@ func _process(delta: float) -> void:
|
||||
|
||||
# Event methods (cleaned up)
|
||||
func start() -> void:
|
||||
assert(
|
||||
self.is_inside_tree(),
|
||||
"Event is trying to start but the node is not part of the scene tree. "+
|
||||
"Refer to EventSystem.addEvent"
|
||||
)
|
||||
assert(started == false)
|
||||
started = true
|
||||
|
||||
@@ -34,6 +37,8 @@ func isDone() -> bool:
|
||||
func end() -> void:
|
||||
assert(ended == false)
|
||||
ended = true
|
||||
if self.inEventSystemTree:
|
||||
EVENT.removeEvent(self)
|
||||
|
||||
func isEndingEvent() -> bool:
|
||||
return false
|
||||
|
Reference in New Issue
Block a user