started research skills

This commit is contained in:
2024-03-29 10:25:53 -05:00
parent f57f7f5540
commit 39157dded2
29 changed files with 1282 additions and 19 deletions

View File

@@ -1,5 +1,10 @@
extends Node
class_name Researcher
func interact() -> bool:
const RESEARCH_MENU = preload("res://scene/research_menu.tscn")
func interact(on_interaction_finished: Callable) -> bool:
var build_menu = RESEARCH_MENU.instantiate()
build_menu.research.connect(on_interaction_finished)
add_sibling(build_menu)
return true

View File

@@ -1,8 +1,9 @@
[gd_resource type="Resource" script_class="Building" load_steps=5 format=3 uid="uid://bibep1rd0jml2"]
[gd_resource type="Resource" script_class="Building" load_steps=6 format=3 uid="uid://bibep1rd0jml2"]
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_kruad"]
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="2_hybxl"]
[ext_resource type="Script" path="res://data/buildings/building.gd" id="3_pleu3"]
[ext_resource type="PackedScene" uid="uid://bw3j3vxpsfxst" path="res://data/buildings/basic/researcher/researcher.tscn" id="4_sugjm"]
[sub_resource type="AtlasTexture" id="AtlasTexture_n7l2d"]
atlas = ExtResource("1_kruad")
@@ -16,3 +17,4 @@ description = "Research new buildings and technologies"
cost = {
ExtResource("2_hybxl"): 6000
}
world_scene = ExtResource("4_sugjm")

View File

@@ -2,6 +2,7 @@ class_name BuildingBase
extends Node2D
var _building_data: Building
var building_data_scene
@onready var sprite_2d: Sprite2D = $Sprite2D
@@ -9,11 +10,9 @@ func initialize(data: Building, grid_location: Vector2i) -> void:
_building_data = data
position = Grid.grid_to_world_center(grid_location)
sprite_2d.texture = _building_data.atlas_texture
var building_data_scene = _building_data.world_scene.instantiate()
add_child(building_data_scene)
if _building_data.world_scene:
building_data_scene = _building_data.world_scene.instantiate()
add_child(building_data_scene)
func _ready() -> void:
_building_data.ready(self)
func interact() -> bool:
return false
func interact(on_interaction_finished: Callable) -> bool:
return building_data_scene.interact(on_interaction_finished)