Improved quest system
This commit is contained in:
45
proto2/ui/interaction.gd
Normal file
45
proto2/ui/interaction.gd
Normal file
@@ -0,0 +1,45 @@
|
||||
extends Control
|
||||
|
||||
var active_npc
|
||||
|
||||
func hire_as_team():
|
||||
var npc_data: Dictionary = active_npc.get_meta("data")
|
||||
var newkey = 0
|
||||
var teamkeys = world.team.keys()
|
||||
if teamkeys.size() > 0:
|
||||
var maxkey = teamkeys.max()
|
||||
newkey = maxkey + 1
|
||||
if npc_data.gender == 0:
|
||||
var dst_node = get_node("/root/main/quest_dst_male_dorm")
|
||||
var dst = dst_node.global_transform.origin
|
||||
active_npc.walkto(dst)
|
||||
world.team[newkey] = npc_data
|
||||
print("line: ", world.line.size())
|
||||
world.line.erase(npc_data.id)
|
||||
npc_data.erase("id")
|
||||
print("line2: ", world.line.size())
|
||||
npc_data.type = 0
|
||||
else:
|
||||
var dst_node = get_node("/root/main/quest_dst_female_dorm")
|
||||
var dst = dst_node.global_transform.origin
|
||||
active_npc.walkto(dst)
|
||||
world.team[newkey] = npc_data
|
||||
print("line: ", world.line.size())
|
||||
world.line.erase(npc_data.id)
|
||||
npc_data.erase("id")
|
||||
print("line2: ", world.line.size())
|
||||
npc_data.type = 0
|
||||
hide()
|
||||
func hire_as_cheer_team():
|
||||
hide()
|
||||
func _ready():
|
||||
hide()
|
||||
$h/hire_team.connect("pressed", self, "hire_as_team")
|
||||
$h/hire_cheer_team.connect("pressed", self, "hire_as_cheer_team")
|
||||
func start_interaction(npc):
|
||||
active_npc = npc
|
||||
show()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
41
proto2/ui/interaction.tscn
Normal file
41
proto2/ui/interaction.tscn
Normal file
@@ -0,0 +1,41 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://ui/interaction.gd" type="Script" id=1]
|
||||
|
||||
[node name="interaction" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_min_size = Vector2( 0, 96 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="h" type="HBoxContainer" parent="."]
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -64.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="hire_team" type="TextureButton" parent="h"]
|
||||
margin_right = 64.0
|
||||
margin_bottom = 64.0
|
||||
rect_min_size = Vector2( 64, 64 )
|
||||
|
||||
[node name="Polygon2D" type="Polygon2D" parent="h/hire_team"]
|
||||
polygon = PoolVector2Array( 11.513, 35.9185, 25.1051, 23.7134, 38.1424, 35.0864 )
|
||||
|
||||
[node name="hire_cheer_team" type="TextureButton" parent="h"]
|
||||
margin_left = 68.0
|
||||
margin_right = 132.0
|
||||
margin_bottom = 64.0
|
||||
rect_min_size = Vector2( 64, 64 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Polygon2D2" type="Polygon2D" parent="h/hire_cheer_team"]
|
||||
polygon = PoolVector2Array( 11.513, 35.9185, 25.1051, 23.7134, 38.1424, 35.0864 )
|
||||
Reference in New Issue
Block a user