researcher work
This commit is contained in:
@@ -1 +1,5 @@
|
|||||||
extends Building
|
extends Node
|
||||||
|
class_name Researcher
|
||||||
|
|
||||||
|
func interact() -> bool:
|
||||||
|
return true
|
||||||
|
|||||||
6
data/buildings/basic/researcher/researcher.tscn
Normal file
6
data/buildings/basic/researcher/researcher.tscn
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bw3j3vxpsfxst"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://data/buildings/basic/researcher/researcher.gd" id="1_018kr"]
|
||||||
|
|
||||||
|
[node name="Researcher" type="Node"]
|
||||||
|
script = ExtResource("1_018kr")
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
[gd_resource type="Resource" load_steps=5 format=3 uid="uid://bibep1rd0jml2"]
|
[gd_resource type="Resource" script_class="Building" load_steps=5 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="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="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="2_hybxl"]
|
||||||
[ext_resource type="Script" path="res://data/buildings/basic/researcher/researcher.gd" id="3_h2kjx"]
|
[ext_resource type="Script" path="res://data/buildings/building.gd" id="3_pleu3"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ejp6g"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_n7l2d"]
|
||||||
atlas = ExtResource("1_kruad")
|
atlas = ExtResource("1_kruad")
|
||||||
region = Rect2(1024, 128, 64, 64)
|
region = Rect2(1024, 128, 64, 64)
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("3_h2kjx")
|
script = ExtResource("3_pleu3")
|
||||||
atlas_texture = SubResource("AtlasTexture_ejp6g")
|
atlas_texture = SubResource("AtlasTexture_n7l2d")
|
||||||
name = "Researcher"
|
name = "Researcher"
|
||||||
description = "Research new buildings and technologies"
|
description = "Research new buildings and technologies"
|
||||||
cost = {
|
cost = {
|
||||||
|
|||||||
@@ -5,8 +5,12 @@ extends Resource
|
|||||||
@export var name: String
|
@export var name: String
|
||||||
@export var description: String
|
@export var description: String
|
||||||
@export var cost: Dictionary
|
@export var cost: Dictionary
|
||||||
|
@export var world_scene: PackedScene
|
||||||
|
|
||||||
|
|
||||||
func initialize(building: BuildingBase) -> void:
|
func initialize(building: BuildingBase) -> void:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func ready(building: BuildingBase) -> void:
|
func ready(building: BuildingBase) -> void:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
extends Node2D
|
|
||||||
class_name BuildingBase
|
class_name BuildingBase
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
var _building_data: Building
|
var _building_data: Building
|
||||||
|
|
||||||
@@ -8,8 +8,12 @@ var _building_data: Building
|
|||||||
func initialize(data: Building, grid_location: Vector2i) -> void:
|
func initialize(data: Building, grid_location: Vector2i) -> void:
|
||||||
_building_data = data
|
_building_data = data
|
||||||
position = Grid.grid_to_world_center(grid_location)
|
position = Grid.grid_to_world_center(grid_location)
|
||||||
_building_data.initialize(self)
|
sprite_2d.texture = _building_data.atlas_texture
|
||||||
|
var building_data_scene = _building_data.world_scene.instantiate()
|
||||||
|
add_child(building_data_scene)
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
sprite_2d.texture = _building_data.atlas_texture
|
|
||||||
_building_data.ready(self)
|
_building_data.ready(self)
|
||||||
|
|
||||||
|
func interact() -> bool:
|
||||||
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user