Conversation
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://dx6fv8n4jl5ku"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dx6fv8n4jl5ku"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://yhtpoum3eek7" path="res://scenes/Entities/Rosa.tscn" id="1_7b7hx"]
|
||||
[ext_resource type="PackedScene" uid="uid://dr4b2pmsknuhc" path="res://scenes/Entities/TestNPC.tscn" id="2_cg1ph"]
|
||||
[ext_resource type="PackedScene" uid="uid://lh713g04d3bg" path="res://scenes/Maps/TestMap/TestMapGround.tscn" id="3_gxq5o"]
|
||||
[ext_resource type="PackedScene" uid="uid://boj5o4fx41rv8" path="res://scenes/Maps/TestMap/TestMapBuilding.tscn" id="4_brp0k"]
|
||||
[ext_resource type="Script" path="res://scripts/Events/EventTextbox.gd" id="5_cg1ph"]
|
||||
[ext_resource type="Script" uid="uid://sqi2ehu4sqa1" path="res://scripts/Events/EventGroup.gd" id="5_gxq5o"]
|
||||
[ext_resource type="Script" uid="uid://bv36suxm08vqe" path="res://scripts/Events/EventPause.gd" id="6_brp0k"]
|
||||
[ext_resource type="Script" uid="uid://tkfc88q8m86f" path="res://scripts/Events/EventConversation.gd" id="5_cg1ph"]
|
||||
[ext_resource type="Script" path="res://scripts/Events/EventTextbox.gd" id="6_gxq5o"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_e1h75"]
|
||||
sky_horizon_color = Color(0.59625, 0.6135, 0.6375, 1)
|
||||
@@ -56,19 +55,12 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.92766, 2.37929, -4.38178)
|
||||
[node name="Events" type="Node" parent="."]
|
||||
|
||||
[node name="TestGroup" type="Node" parent="Events"]
|
||||
script = ExtResource("5_gxq5o")
|
||||
|
||||
[node name="Pause" type="Node" parent="Events/TestGroup"]
|
||||
script = ExtResource("6_brp0k")
|
||||
script = ExtResource("5_cg1ph")
|
||||
|
||||
[node name="Text 0" type="Node" parent="Events/TestGroup"]
|
||||
script = ExtResource("5_cg1ph")
|
||||
script = ExtResource("6_gxq5o")
|
||||
text = "Text 0"
|
||||
|
||||
[node name="Text 1" type="Node" parent="Events/TestGroup"]
|
||||
script = ExtResource("5_cg1ph")
|
||||
script = ExtResource("6_gxq5o")
|
||||
text = "Text 1"
|
||||
|
||||
[node name="Resume" type="Node" parent="Events/TestGroup"]
|
||||
script = ExtResource("6_brp0k")
|
||||
pauseType = 0
|
||||
|
9
scripts/Events/Entity/EventEntityTurn.gd
Normal file
9
scripts/Events/Entity/EventEntityTurn.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
class_name EventEntityTurn extends "res://scripts/Events/Event.gd"
|
||||
|
||||
@export var entity:OverworldEntity = null
|
||||
@export var direction:OverworldEntity.Direction = OverworldEntity.Direction.SOUTH
|
||||
|
||||
func start():
|
||||
if entity == null:
|
||||
return
|
||||
entity.direction = direction
|
1
scripts/Events/Entity/EventEntityTurn.gd.uid
Normal file
1
scripts/Events/Entity/EventEntityTurn.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bmcrd2ugqan43
|
68
scripts/Events/EventConversation.gd
Normal file
68
scripts/Events/EventConversation.gd
Normal file
@@ -0,0 +1,68 @@
|
||||
class_name EventConversation extends "res://scripts/Events/Flow/EventGroup.gd"
|
||||
|
||||
@export var startPauseType:PauseSystem.PauseType = PauseSystem.PauseType.ENTITY_PAUSED
|
||||
@export var endPauseType:PauseSystem.PauseType = PauseSystem.PauseType.NOT_PAUSED
|
||||
|
||||
@export var entities:Array[OverworldEntity] = []
|
||||
|
||||
@export var includeInteractee:bool = true
|
||||
@export var includeInteractor:bool = true
|
||||
|
||||
var extraEvents:Array[Event] = []
|
||||
|
||||
func start() -> void:
|
||||
|
||||
# Turn events
|
||||
if interactee != null && interactor != null:
|
||||
if includeInteractee:
|
||||
var turninteractee = EventEntityTurn.new()
|
||||
turninteractee.entity = interactee
|
||||
turninteractee.direction = interactee.getDirectionToFace(interactor.position)
|
||||
self.add_child(turninteractee)
|
||||
extraEvents.append(turninteractee)
|
||||
self.move_child(turninteractee, 0)
|
||||
|
||||
if includeInteractor:
|
||||
var turninteractor = EventEntityTurn.new()
|
||||
turninteractor.entity = interactor
|
||||
turninteractor.direction = interactor.getDirectionToFace(interactee.position)
|
||||
self.add_child(turninteractor)
|
||||
extraEvents.append(turninteractor)
|
||||
self.move_child(turninteractor, 0)
|
||||
|
||||
# Create start pause event
|
||||
var startPause = EventPause.new()
|
||||
startPause.pauseType = startPauseType
|
||||
startPause.entities = entities
|
||||
self.add_child(startPause)
|
||||
extraEvents.append(startPause)
|
||||
self.move_child(startPause, 0)
|
||||
|
||||
# Create end pause event.
|
||||
var endPause = EventPause.new()
|
||||
endPause.pauseType = endPauseType
|
||||
endPause.entities = entities
|
||||
self.add_child(endPause)
|
||||
extraEvents.append(endPause)
|
||||
self.move_child(endPause, get_child_count() - 1)
|
||||
|
||||
# Pass off to event group
|
||||
super.start()
|
||||
|
||||
func reset() -> void:
|
||||
# Let event group reset normally
|
||||
super.reset()
|
||||
|
||||
# Remove the events we created.
|
||||
cleanupExtraEvents()
|
||||
|
||||
func end() -> void:
|
||||
# Let event group end normally
|
||||
super.end()
|
||||
# Remove the events we created.
|
||||
cleanupExtraEvents()
|
||||
|
||||
func cleanupExtraEvents():
|
||||
for event in extraEvents:
|
||||
event.queue_free()
|
||||
extraEvents = []
|
@@ -1,4 +1,4 @@
|
||||
class_name EventGroup extends "res://scripts/Events/EventWithChildren.gd"
|
||||
class_name EventGroup extends "res://scripts/Events/Flow/EventWithChildren.gd"
|
||||
|
||||
enum ProcessType {
|
||||
SEQUENTIAL,
|
||||
@@ -73,4 +73,4 @@ func startChild(child:Event) -> void:
|
||||
# Inherits some properties from this event.
|
||||
child.interactee = self.interactee
|
||||
child.interactor = self.interactor
|
||||
child.start()
|
||||
child.start()
|
1
scripts/Events/Flow/EventGroup.gd.uid
Normal file
1
scripts/Events/Flow/EventGroup.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bb1qpptyr1rec
|
@@ -8,6 +8,7 @@ func _init() -> void:
|
||||
_updateChildEvents()
|
||||
self.child_entered_tree.connect(onChildEntered)
|
||||
self.child_exiting_tree.connect(onChildExited)
|
||||
self.child_order_changed.connect(onChildOrderChanged)
|
||||
|
||||
func _updateChildEvents() -> void:
|
||||
childEvents = []
|
||||
@@ -20,3 +21,6 @@ func onChildEntered(child:Node) -> void:
|
||||
|
||||
func onChildExited(child:Node) -> void:
|
||||
_updateChildEvents()
|
||||
|
||||
func onChildOrderChanged() -> void:
|
||||
_updateChildEvents()
|
1
scripts/Events/Flow/EventWithChildren.gd.uid
Normal file
1
scripts/Events/Flow/EventWithChildren.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bs78jtft61ro6
|
Reference in New Issue
Block a user