mirror of
https://github.com/tpawstdio/skyscraperrising.git
synced 2025-05-05 14:14:50 -04:00
Basic office functionality
When an office is no longer vacant, rent timer will start and the player will be paid on and the timer will be restarted on timeout.
This commit is contained in:
parent
68e75226e6
commit
8586220975
3 changed files with 27 additions and 0 deletions
|
@ -4,3 +4,7 @@
|
|||
|
||||
[node name="Office" type="Node2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Rent" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
[connection signal="timeout" from="Rent" to="." method="_on_Rent_timeout"]
|
||||
|
|
|
@ -23,9 +23,15 @@ config/icon="res://icon.png"
|
|||
|
||||
TowerData="*res://src/autoload/twrdata.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/aspect="keep"
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
quality/2d/gles2_use_nvidia_rect_flicker_workaround=true
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
|
|
@ -1,9 +1,26 @@
|
|||
extends Node2D
|
||||
|
||||
const OFFICE_PRICE = 1000
|
||||
const OFFICE_INCOME = 500
|
||||
const MAINTANCE_COST = 350
|
||||
|
||||
export var is_vacant: bool = true
|
||||
|
||||
func _ready():
|
||||
# Once placed in-world, it'll substract from your budget
|
||||
if TowerData.budget >= OFFICE_PRICE:
|
||||
TowerData.budget = -OFFICE_PRICE
|
||||
|
||||
|
||||
func _process(delta):
|
||||
|
||||
# If the office is no longer vacant, start rent timer
|
||||
if is_vacant == false:
|
||||
$Rent.start()
|
||||
else:
|
||||
$Rent.stop()
|
||||
|
||||
func _on_Rent_timeout():
|
||||
# On timeout, pay the player and restart timer
|
||||
TowerData.budget = OFFICE_INCOME
|
||||
$Rent.start()
|
||||
|
|
Loading…
Add table
Reference in a new issue