Event Go To
This commit is contained in:
@@ -35,6 +35,9 @@ func end() -> void:
|
||||
assert(ended == false)
|
||||
ended = true
|
||||
|
||||
func isEndingEvent() -> bool:
|
||||
return false
|
||||
|
||||
func reset() -> void:
|
||||
started = false
|
||||
ended = false
|
||||
|
@@ -10,6 +10,8 @@ class_name EventConversation extends "res://scripts/Event/Flow/EventGroup.gd"
|
||||
@export var turnInteractee:bool = true
|
||||
@export var turnInteractor:bool = true
|
||||
|
||||
var endPauseEvent:EventPause = null
|
||||
|
||||
func start() -> void:
|
||||
# Turn events
|
||||
if interactee && interactor:
|
||||
@@ -37,14 +39,20 @@ func start() -> void:
|
||||
addExtraEvent(startPause, 0)
|
||||
|
||||
# Create end pause event.
|
||||
var endPause = EventPause.new()
|
||||
endPause.pauseType = endPauseType
|
||||
endPause.entities = entities
|
||||
endPauseEvent = EventPause.new()
|
||||
endPauseEvent.pauseType = endPauseType
|
||||
endPauseEvent.entities = entities
|
||||
if pauseInteractee && interactee.entity:
|
||||
endPause.includeInteractee = pauseInteractee
|
||||
endPauseEvent.includeInteractee = pauseInteractee
|
||||
if pauseInteractor && interactor.entity:
|
||||
endPause.includeInteractor = pauseInteractor
|
||||
addExtraEvent(endPause, -1)
|
||||
endPauseEvent.includeInteractor = pauseInteractor
|
||||
addExtraEvent(endPauseEvent, -1)
|
||||
|
||||
# Pass off to event group
|
||||
super.start()
|
||||
|
||||
func end() -> void:
|
||||
# Manually end pause
|
||||
if endPauseEvent != null && !endPauseEvent.started:
|
||||
endPauseEvent.start()
|
||||
super.end()
|
||||
|
@@ -7,10 +7,11 @@ const PauseSystem = preload("res://scripts/Singleton/Pause.gd")
|
||||
@export var includeInteractee:bool = true
|
||||
@export var includeInteractor:bool = true
|
||||
|
||||
func start() -> void:
|
||||
func end() -> void:
|
||||
super.end()
|
||||
var ents:Array[Entity] = entities
|
||||
if interactor && includeInteractor && interactor.entity:
|
||||
ents.append(interactor.entity)
|
||||
if interactee && includeInteractee && interactee.entity:
|
||||
ents.append(interactee.entity)
|
||||
PAUSE.pause(pauseType, ents)
|
||||
PAUSE.pause(pauseType, ents)
|
35
scripts/Event/Flow/EventGoTo.gd
Normal file
35
scripts/Event/Flow/EventGoTo.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
class_name EventGoTo extends "res://scripts/Event/Event.gd"
|
||||
|
||||
enum Type {
|
||||
GO_TO,
|
||||
GO_TO_AND_WAIT,
|
||||
GO_TO_AND_CONTINUE
|
||||
}
|
||||
|
||||
@export var event:Event = null
|
||||
@export var type:Type = Type.GO_TO
|
||||
|
||||
func start() -> void:
|
||||
super.start()
|
||||
if event == null:
|
||||
print("EventGoTo: No event set")
|
||||
return
|
||||
|
||||
event.start()
|
||||
|
||||
func isDone():
|
||||
if !super.isDone():
|
||||
return false
|
||||
|
||||
if event == null:
|
||||
return true
|
||||
|
||||
if type == Type.GO_TO_AND_WAIT:
|
||||
return event.isDone()
|
||||
|
||||
return true
|
||||
|
||||
func isEndingEvent() -> bool:
|
||||
if type == Type.GO_TO:
|
||||
return true
|
||||
return false
|
1
scripts/Event/Flow/EventGoTo.gd.uid
Normal file
1
scripts/Event/Flow/EventGoTo.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://da7fr2bave0c
|
@@ -76,3 +76,6 @@ func startChild(child:Event) -> void:
|
||||
child.interactee = self.interactee
|
||||
child.interactor = self.interactor
|
||||
child.start()
|
||||
|
||||
if child.isEndingEvent():
|
||||
self.end()
|
Reference in New Issue
Block a user