diff --git a/components/Characters/Rooster.tscn b/components/Characters/Rooster.tscn index 5650ac7..55d1535 100644 --- a/components/Characters/Rooster.tscn +++ b/components/Characters/Rooster.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://cvogxi7mktumf" path="res://components/Abstracts/EntityBase.tscn" id="1_e5pl8"] [ext_resource type="Script" uid="uid://cthtupc6dtbav" path="res://scripts/Contents/Characters/Rooster.gd" id="2_oqdqd"] -[ext_resource type="PackedScene" uid="uid://c0n3igy4hucrg" path="res://components/Weapons/PurpleCrystal.tscn" id="3_s7kxe"] +[ext_resource type="PackedScene" uid="uid://dlaks67h2osms" path="res://components/Weapons/ChainGun.tscn" id="3_s7kxe"] [ext_resource type="AudioStream" uid="uid://cdrevrq7n6yqa" path="res://resources/sounds/effect/Boing.mp3" id="4_66s6c"] [ext_resource type="AudioStream" uid="uid://benyec5bqni0b" path="res://resources/sounds/effect/Chomp.wav" id="4_k0yme"] [ext_resource type="AudioStream" uid="uid://dmxh3bpk8vyy5" path="res://resources/sounds/effect/Coin.mp3" id="5_xnbhq"] @@ -97,7 +97,8 @@ process_material = SubResource("ParticleProcessMaterial_joj4g") [node name="weaponStore" parent="." index="2"] process_mode = 4 -[node name="PurpleCrystal" parent="weaponStore" index="0" unique_id=1991730660 instance=ExtResource("3_s7kxe")] +[node name="ChainGun" parent="weaponStore" index="0" unique_id=1992324853 instance=ExtResource("3_s7kxe")] +debugRebuild = false [node name="sprint" parent="sounds" index="0"] stream = ExtResource("4_66s6c") diff --git a/scripts/Contents/Panels/MakeFeed.gd b/scripts/Contents/Panels/MakeFeed.gd index b2e09ca..eea4ab0 100644 --- a/scripts/Contents/Panels/MakeFeed.gd +++ b/scripts/Contents/Panels/MakeFeed.gd @@ -36,6 +36,9 @@ func _ready(): updateValue() if selectedCount >= UIState.player.fields[FieldStore.Entity.FEED_COUNT_CAN_MADE]: finish() + for feedCard in feedCards.get_children(): + if feedCard is Feed: + feed.rebuildInfo() ) avaliableFeeds.add_child(feed) diff --git a/scripts/Contents/Panels/Starter.gd b/scripts/Contents/Panels/Starter.gd index bd975e4..1c59ba5 100644 --- a/scripts/Contents/Panels/Starter.gd +++ b/scripts/Contents/Panels/Starter.gd @@ -164,15 +164,19 @@ func beforeOpen(_args: Array = []): diffEdit.max_value = GameRule.difficultyRange.y diffEdit.value = GameRule.difficulty setState(MultiplayerState.ConnectionState.DISCONNECTED) + rebuildInfo() + startSingleplayerBtn.disabled = false + Wave.current = 0 +func rebuildInfo(): crystalShow.count = OutGameStorage.inventory[ItemStore.ItemType.CRYSTAL] diamondShow.count = OutGameStorage.inventory[ItemStore.ItemType.DIAMOND] for child in upgradeFieldsBox.get_children(): upgradeFieldsBox.remove_child(child) for field in OutGameStorage.upgradableFieldsAdvance: var fieldShow = ComponentManager.getUIComponent("FieldShow").instantiate() as FieldShow - fieldShow.cost(ItemStore.ItemType.CRYSTAL, 50 * OutGameStorage.upgradableFieldsLevel[fieldShow.field]) - fieldShow.cost(ItemStore.ItemType.DIAMOND, OutGameStorage.upgradableFieldsLevel[fieldShow.field] - 1) + fieldShow.cost(ItemStore.ItemType.CRYSTAL, OutGameStorage.upgradableFieldsCost[ItemStore.ItemType.CRYSTAL] * (OutGameStorage.upgradableFieldsLevel[field] + 1)) + fieldShow.cost(ItemStore.ItemType.DIAMOND, OutGameStorage.upgradableFieldsCost[ItemStore.ItemType.DIAMOND] * OutGameStorage.upgradableFieldsLevel[field]) fieldShow.upgradable = true fieldShow.upgradeValue = OutGameStorage.upgradableFieldsAdvance[field] fieldShow.field = field @@ -182,13 +186,6 @@ func beforeOpen(_args: Array = []): func(newValue: float): OutGameStorage.upgradableFieldsValue[fieldShow.field] = newValue OutGameStorage.upgradableFieldsLevel[fieldShow.field] += 1 - for index in len(fieldShow.costCounts): - if fieldShow.costCounts[index] == 0: - fieldShow.costCounts[index] += 1 - else: - fieldShow.costCounts[index] *= (OutGameStorage.upgradableFieldsLevel[fieldShow.field] + 1) / OutGameStorage.upgradableFieldsLevel[fieldShow.field] + rebuildInfo() ) upgradeFieldsBox.add_child(fieldShow) - - startSingleplayerBtn.disabled = false - Wave.current = 0 diff --git a/scripts/Statemachine/EntityBase.gd b/scripts/Statemachine/EntityBase.gd index 2b4daf2..d5d14ae 100644 --- a/scripts/Statemachine/EntityBase.gd +++ b/scripts/Statemachine/EntityBase.gd @@ -560,8 +560,12 @@ static func generatePlayer(playerName: String) -> EntityBase: var player = generate(ComponentManager.getCharacter("Rooster"), Vector2.ZERO, false) player.displayName = playerName player.name = "Player_%s" % playerName + var feed = ComponentManager.getAbstract("FeedCardBase").instantiate() as Feed for field in OutGameStorage.upgradableFieldsValue: - player.fields[field] += OutGameStorage.upgradableFieldsValue[field] + feed.fields.append(field) + feed.fieldValues.append(OutGameStorage.upgradableFieldsValue[field]) + feed.freeToBuy = true + feed.apply(player) return player static func generate( entity: PackedScene, diff --git a/scripts/Tools/Managers/ComponentManager.gd b/scripts/Tools/Managers/ComponentManager.gd index ac842b3..097a4e7 100644 --- a/scripts/Tools/Managers/ComponentManager.gd +++ b/scripts/Tools/Managers/ComponentManager.gd @@ -2,6 +2,7 @@ extends Node class_name ComponentManager +static var abstracts = {} static var bullets = {} static var characters = {} static var weapons = {} @@ -16,6 +17,8 @@ static var fieldTextures = {} static var itemTextures = {} static func init(): + for i in DirTool.listdir("res://components/Abstracts"): + abstracts[DirTool.getBasenameWithoutExtension(i)] = load(i) for i in DirTool.listdir("res://components/Bullets"): bullets[DirTool.getBasenameWithoutExtension(i)] = load(i) for i in DirTool.listdir("res://components/Characters"): @@ -40,6 +43,9 @@ static func init(): fieldTextures[DirTool.getBasenameWithoutExtension(i)] = load(i) for i in DirTool.listdir("res://resources/items"): itemTextures[DirTool.getBasenameWithoutExtension(i)] = load(i) + +static func getAbstract(t: String) -> PackedScene: + return MathTool.priority(abstracts.get(t, false), load("res://components/Abstracts/%s.tscn" % t)) static func getBullet(t: String) -> PackedScene: return MathTool.priority(bullets.get(t, false), load("res://components/Bullets/%s.tscn" % t)) static func getCharacter(t: String) -> PackedScene: diff --git a/scripts/Tools/OutGameStorage.gd b/scripts/Tools/OutGameStorage.gd index ae6809b..094525f 100644 --- a/scripts/Tools/OutGameStorage.gd +++ b/scripts/Tools/OutGameStorage.gd @@ -7,6 +7,10 @@ static var inventory = { ItemStore.ItemType.DIAMOND: 0 } +static var upgradableFieldsCost = { + ItemStore.ItemType.CRYSTAL: 50, + ItemStore.ItemType.DIAMOND: 1, +} static var upgradableFieldsAdvance = { FieldStore.Entity.MAX_HEALTH: 10, FieldStore.Entity.DAMAGE_MULTIPILER: 0.1, @@ -20,8 +24,8 @@ static var upgradableFieldsValue = { FieldStore.Entity.PRICE_REDUCTION: 0, } static var upgradableFieldsLevel = { - FieldStore.Entity.MAX_HEALTH: 1, - FieldStore.Entity.DAMAGE_MULTIPILER: 1, - FieldStore.Entity.ATTACK_SPEED: 1, - FieldStore.Entity.PRICE_REDUCTION: 1, + FieldStore.Entity.MAX_HEALTH: 0, + FieldStore.Entity.DAMAGE_MULTIPILER: 0, + FieldStore.Entity.ATTACK_SPEED: 0, + FieldStore.Entity.PRICE_REDUCTION: 0, } \ No newline at end of file