egrading armor and universal veil
This commit is contained in:
parent
1692477176
commit
29254dbda0
22 changed files with 142 additions and 30 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.4 KiB |
BIN
assets/sprites/atlases/zombies/armor.aseprite
Normal file
BIN
assets/sprites/atlases/zombies/armor.aseprite
Normal file
Binary file not shown.
BIN
assets/sprites/atlases/zombies/armor.png
Normal file
BIN
assets/sprites/atlases/zombies/armor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
34
assets/sprites/atlases/zombies/armor.png.import
Normal file
34
assets/sprites/atlases/zombies/armor.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b18blso5pbc6a"
|
||||||
|
path="res://.godot/imported/armor.png-18d1dee9d58098145c2a15ea84198bc9.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sprites/atlases/zombies/armor.png"
|
||||||
|
dest_files=["res://.godot/imported/armor.png-18d1dee9d58098145c2a15ea84198bc9.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://ce04l60l6mhfk"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cmxh4w4gkgdjm" path="res://assets/sprites/atlases/zombies/basic.png" id="1_n66kp"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
atlas = ExtResource("1_n66kp")
|
|
||||||
region = Rect2(21, 23, 34, 38)
|
|
||||||
7
assets/sprites/bucket1.tres
Normal file
7
assets/sprites/bucket1.tres
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://ce04l60l6mhfk"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b18blso5pbc6a" path="res://assets/sprites/atlases/zombies/armor.png" id="1_drgch"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_drgch")
|
||||||
|
region = Rect2(0, 33, 34, 38)
|
||||||
7
assets/sprites/bucket2.tres
Normal file
7
assets/sprites/bucket2.tres
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://ikk4jp7mvm3s"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b18blso5pbc6a" path="res://assets/sprites/atlases/zombies/armor.png" id="1_l2quk"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_l2quk")
|
||||||
|
region = Rect2(34, 33, 33, 36)
|
||||||
7
assets/sprites/bucket3.tres
Normal file
7
assets/sprites/bucket3.tres
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://cmmpfi8ug43l2"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b18blso5pbc6a" path="res://assets/sprites/atlases/zombies/armor.png" id="1_n3lqc"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_n3lqc")
|
||||||
|
region = Rect2(67, 33, 29, 33)
|
||||||
7
assets/sprites/cone2.tres
Normal file
7
assets/sprites/cone2.tres
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://cl5ekw72wi75c"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b18blso5pbc6a" path="res://assets/sprites/atlases/zombies/armor.png" id="1_au0m1"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_au0m1")
|
||||||
|
region = Rect2(31, 1, 31, 32)
|
||||||
7
assets/sprites/cone3.tres
Normal file
7
assets/sprites/cone3.tres
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://cnn81r1y0xwod"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b18blso5pbc6a" path="res://assets/sprites/atlases/zombies/armor.png" id="1_rrcfd"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
atlas = ExtResource("1_rrcfd")
|
||||||
|
region = Rect2(62, 11, 31, 22)
|
||||||
|
|
@ -29,7 +29,6 @@ AudioSequencer="*res://scenes/audio_sequencer.tscn"
|
||||||
window/size/viewport_width=600
|
window/size/viewport_width=600
|
||||||
window/size/viewport_height=400
|
window/size/viewport_height=400
|
||||||
window/stretch/mode="canvas_items"
|
window/stretch/mode="canvas_items"
|
||||||
window/per_pixel_transparency/allowed=true
|
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
|
||||||
|
|
@ -91,4 +90,3 @@ cheat_zombie_spawn={
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
textures/canvas_textures/default_texture_filter=0
|
textures/canvas_textures/default_texture_filter=0
|
||||||
2d/snap/snap_2d_transforms_to_pixel=true
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://xu4i6tmkv00a"]
|
[gd_scene load_steps=12 format=3 uid="uid://xu4i6tmkv00a"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://hhjbqkjqpt7x" path="res://scenes/entities/Zombies/cone_zombie.tscn" id="1_mwqpo"]
|
[ext_resource type="PackedScene" uid="uid://hhjbqkjqpt7x" path="res://scenes/entities/Zombies/cone_zombie.tscn" id="1_mwqpo"]
|
||||||
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_3mrqj"]
|
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_3mrqj"]
|
||||||
[ext_resource type="Texture2D" uid="uid://ce04l60l6mhfk" path="res://assets/sprites/bucket.tres" id="3_0nlp0"]
|
[ext_resource type="Texture2D" uid="uid://ce04l60l6mhfk" path="res://assets/sprites/bucket1.tres" id="3_0nlp0"]
|
||||||
[ext_resource type="Script" uid="uid://c3cfnrmnnuqms" path="res://addons/floatmodifiers/FloatModifiers.cs" id="4_1s2fn"]
|
[ext_resource type="Script" uid="uid://c3cfnrmnnuqms" path="res://addons/floatmodifiers/FloatModifiers.cs" id="4_1s2fn"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ikk4jp7mvm3s" path="res://assets/sprites/bucket2.tres" id="4_xx7fu"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bu1egfsyplpx4" path="res://assets/audio/sfx/metalhit_generic.tres" id="5_lt6ps"]
|
[ext_resource type="AudioStream" uid="uid://bu1egfsyplpx4" path="res://assets/audio/sfx/metalhit_generic.tres" id="5_lt6ps"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cmmpfi8ug43l2" path="res://assets/sprites/bucket3.tres" id="5_v1iwd"]
|
||||||
[ext_resource type="AudioStream" uid="uid://w0qfwds4o3ti" path="res://assets/audio/sfx/hit_generic.tres" id="6_kedip"]
|
[ext_resource type="AudioStream" uid="uid://w0qfwds4o3ti" path="res://assets/audio/sfx/hit_generic.tres" id="6_kedip"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wdi07"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wdi07"]
|
||||||
|
|
@ -38,6 +40,7 @@ position = Vector2(-13, -82)
|
||||||
[node name="Sprite" parent="CanvasGroup/Hat" index="0"]
|
[node name="Sprite" parent="CanvasGroup/Hat" index="0"]
|
||||||
position = Vector2(1, 0)
|
position = Vector2(1, 0)
|
||||||
texture = ExtResource("3_0nlp0")
|
texture = ExtResource("3_0nlp0")
|
||||||
|
degradationStages = Array[Texture]([ExtResource("3_0nlp0"), ExtResource("4_xx7fu"), ExtResource("5_v1iwd")])
|
||||||
|
|
||||||
[node name="Eatbox" parent="." index="2"]
|
[node name="Eatbox" parent="." index="2"]
|
||||||
_damage = SubResource("Resource_2bm8y")
|
_damage = SubResource("Resource_2bm8y")
|
||||||
|
|
@ -46,7 +49,7 @@ _damage = SubResource("Resource_2bm8y")
|
||||||
_speed = SubResource("Resource_lt6ps")
|
_speed = SubResource("Resource_lt6ps")
|
||||||
|
|
||||||
[node name="Armor" parent="." index="7"]
|
[node name="Armor" parent="." index="7"]
|
||||||
_maxHP = 385
|
MaxHP = 430
|
||||||
|
|
||||||
[node name="HitPlayer" parent="." index="8"]
|
[node name="HitPlayer" parent="." index="8"]
|
||||||
playlist = Array[AudioStream]([ExtResource("5_lt6ps"), ExtResource("6_kedip")])
|
playlist = Array[AudioStream]([ExtResource("5_lt6ps"), ExtResource("6_kedip")])
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
[gd_scene load_steps=13 format=3 uid="uid://hhjbqkjqpt7x"]
|
[gd_scene load_steps=16 format=3 uid="uid://hhjbqkjqpt7x"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_3dq4c"]
|
[ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_3dq4c"]
|
||||||
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_2dq8e"]
|
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_2dq8e"]
|
||||||
[ext_resource type="Script" uid="uid://fd4im1fmwc5n" path="res://scripts/components/Armor.cs" id="3_5s7in"]
|
[ext_resource type="Script" uid="uid://fd4im1fmwc5n" path="res://scripts/components/Armor.cs" id="3_5s7in"]
|
||||||
[ext_resource type="Script" uid="uid://dt5uj25u0g6y3" path="res://scripts/components/particles/FallParticle.cs" id="3_w70im"]
|
[ext_resource type="Script" uid="uid://dt5uj25u0g6y3" path="res://scripts/components/particles/FallParticle.cs" id="3_w70im"]
|
||||||
[ext_resource type="Texture2D" uid="uid://ceqvdmude7cgg" path="res://assets/sprites/cone.tres" id="4_qdhik"]
|
[ext_resource type="Texture2D" uid="uid://ceqvdmude7cgg" path="res://assets/sprites/cone1.tres" id="4_qdhik"]
|
||||||
[ext_resource type="Script" uid="uid://c3cfnrmnnuqms" path="res://addons/floatmodifiers/FloatModifiers.cs" id="4_qof5v"]
|
[ext_resource type="Script" uid="uid://c3cfnrmnnuqms" path="res://addons/floatmodifiers/FloatModifiers.cs" id="4_qof5v"]
|
||||||
|
[ext_resource type="Script" uid="uid://bbw848msxb4re" path="res://scripts/components/DegradingSprite.cs" id="5_ickyd"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cl5ekw72wi75c" path="res://assets/sprites/cone2.tres" id="6_b6mal"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bmupd3v3gvsca" path="res://assets/audio/sfx/plastichit_generic.tres" id="7_0amn8"]
|
[ext_resource type="AudioStream" uid="uid://bmupd3v3gvsca" path="res://assets/audio/sfx/plastichit_generic.tres" id="7_0amn8"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cnn81r1y0xwod" path="res://assets/sprites/cone3.tres" id="7_011r0"]
|
||||||
[ext_resource type="AudioStream" uid="uid://w0qfwds4o3ti" path="res://assets/audio/sfx/hit_generic.tres" id="7_67t4t"]
|
[ext_resource type="AudioStream" uid="uid://w0qfwds4o3ti" path="res://assets/audio/sfx/hit_generic.tres" id="7_67t4t"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sat5k"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sat5k"]
|
||||||
|
|
@ -51,9 +54,13 @@ minTorque = -45.0
|
||||||
maxTorque = 45.0
|
maxTorque = 45.0
|
||||||
Impulse = 100.0
|
Impulse = 100.0
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite2D" parent="CanvasGroup/Hat" index="0"]
|
[node name="Sprite" type="Sprite2D" parent="CanvasGroup/Hat" index="0" node_paths=PackedStringArray("armor")]
|
||||||
position = Vector2(-1, -12)
|
position = Vector2(-1, -12)
|
||||||
texture = ExtResource("4_qdhik")
|
texture = ExtResource("4_qdhik")
|
||||||
|
script = ExtResource("5_ickyd")
|
||||||
|
armor = NodePath("../../../Armor")
|
||||||
|
degradationStages = Array[Texture]([ExtResource("4_qdhik"), ExtResource("6_b6mal"), ExtResource("7_011r0")])
|
||||||
|
thresholdPercentage = Array[float]([1.0, 0.667, 0.333])
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CanvasGroup/Hat" index="1"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="CanvasGroup/Hat" index="1"]
|
||||||
position = Vector2(1, -6)
|
position = Vector2(1, -6)
|
||||||
|
|
@ -67,7 +74,7 @@ _speed = SubResource("Resource_qof5v")
|
||||||
|
|
||||||
[node name="Armor" type="Node" parent="." index="7"]
|
[node name="Armor" type="Node" parent="." index="7"]
|
||||||
script = ExtResource("3_5s7in")
|
script = ExtResource("3_5s7in")
|
||||||
_maxHP = 130
|
MaxHP = 125
|
||||||
|
|
||||||
[node name="HitPlayer" parent="." index="8"]
|
[node name="HitPlayer" parent="." index="8"]
|
||||||
playlist = Array[AudioStream]([ExtResource("7_0amn8"), ExtResource("7_67t4t")])
|
playlist = Array[AudioStream]([ExtResource("7_0amn8"), ExtResource("7_67t4t")])
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ _maxHP = 600
|
||||||
texture = ExtResource("2_o5tda")
|
texture = ExtResource("2_o5tda")
|
||||||
hframes = 12
|
hframes = 12
|
||||||
vframes = 3
|
vframes = 3
|
||||||
frame = 10
|
|
||||||
|
|
||||||
[node name="AnimationPlayer" parent="." index="1"]
|
[node name="AnimationPlayer" parent="." index="1"]
|
||||||
libraries = {
|
libraries = {
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ grow_vertical = 2
|
||||||
[node name="PrototypeWindow" type="AcceptDialog" parent="."]
|
[node name="PrototypeWindow" type="AcceptDialog" parent="."]
|
||||||
title = ""
|
title = ""
|
||||||
size = Vector2i(600, 400)
|
size = Vector2i(600, 400)
|
||||||
|
visible = true
|
||||||
unresizable = true
|
unresizable = true
|
||||||
borderless = true
|
borderless = true
|
||||||
theme_override_styles/panel = SubResource("StyleBoxTexture_jl0ue")
|
theme_override_styles/panel = SubResource("StyleBoxTexture_jl0ue")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
[gd_scene load_steps=10 format=3 uid="uid://e7vutg71l6f2"]
|
[gd_scene load_steps=9 format=3 uid="uid://e7vutg71l6f2"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dxyf557m4mq1p" path="res://assets/sprites/gui/EmptyPlantCard.png" id="1_77bw1"]
|
[ext_resource type="Texture2D" uid="uid://dxyf557m4mq1p" path="res://assets/sprites/gui/EmptyPlantCard.png" id="1_77bw1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cxlr34yh0bqch" path="res://assets/sprites/gui/DisabledEmptyCard.png" id="2_2gojx"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cabpf23ndlvx0" path="res://assets/sprites/gui/Selection.tres" id="3_q0tvq"]
|
[ext_resource type="Texture2D" uid="uid://cabpf23ndlvx0" path="res://assets/sprites/gui/Selection.tres" id="3_q0tvq"]
|
||||||
[ext_resource type="Script" uid="uid://cn6ddajdtf4ep" path="res://scripts/components/gui/seedpackets/Seedpacket.cs" id="4_c6epd"]
|
[ext_resource type="Script" uid="uid://cn6ddajdtf4ep" path="res://scripts/components/gui/seedpackets/Seedpacket.cs" id="4_c6epd"]
|
||||||
[ext_resource type="Shader" uid="uid://dcp5tqcec2oi3" path="res://assets/shaders/gui_masking.gdshader" id="5_s5861"]
|
[ext_resource type="Shader" uid="uid://dcp5tqcec2oi3" path="res://assets/shaders/gui_masking.gdshader" id="5_s5861"]
|
||||||
|
|
@ -20,10 +19,10 @@ shader_parameter/mask = ExtResource("1_77bw1")
|
||||||
anchors_preset = -1
|
anchors_preset = -1
|
||||||
anchor_right = 0.137
|
anchor_right = 0.137
|
||||||
anchor_bottom = 0.28
|
anchor_bottom = 0.28
|
||||||
offset_right = -0.200005
|
offset_left = 2.0
|
||||||
|
offset_right = 1.8
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
texture_normal = ExtResource("1_77bw1")
|
texture_normal = ExtResource("1_77bw1")
|
||||||
texture_disabled = ExtResource("2_2gojx")
|
|
||||||
texture_focused = ExtResource("3_q0tvq")
|
texture_focused = ExtResource("3_q0tvq")
|
||||||
stretch_mode = 0
|
stretch_mode = 0
|
||||||
script = ExtResource("4_c6epd")
|
script = ExtResource("4_c6epd")
|
||||||
|
|
@ -90,7 +89,7 @@ step = 0.001
|
||||||
fill_mode = 3
|
fill_mode = 3
|
||||||
nine_patch_stretch = true
|
nine_patch_stretch = true
|
||||||
texture_progress = ExtResource("6_lp42h")
|
texture_progress = ExtResource("6_lp42h")
|
||||||
tint_progress = Color(0, 0, 0, 0.843137)
|
tint_progress = Color(0, 0, 0, 0.501961)
|
||||||
script = ExtResource("7_tv07f")
|
script = ExtResource("7_tv07f")
|
||||||
_referenceTimer = NodePath("../RechargeTimer")
|
_referenceTimer = NodePath("../RechargeTimer")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ size = Vector2(282, 399)
|
||||||
|
|
||||||
[node name="Data" type="Node" parent="."]
|
[node name="Data" type="Node" parent="."]
|
||||||
script = ExtResource("1_tnxdx")
|
script = ExtResource("1_tnxdx")
|
||||||
SunCount = 50
|
SunCount = 10000
|
||||||
|
|
||||||
[node name="Background" type="Sprite2D" parent="."]
|
[node name="Background" type="Sprite2D" parent="."]
|
||||||
position = Vector2(500, 200)
|
position = Vector2(500, 200)
|
||||||
|
|
@ -191,7 +191,6 @@ metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
position = Vector2(481, 200)
|
position = Vector2(481, 200)
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
|
|
||||||
[node name="Pools" type="Node2D" parent="." node_paths=PackedStringArray("Zombies", "Plants", "Projectiles", "Structures", "Particles")]
|
[node name="Pools" type="Node2D" parent="." node_paths=PackedStringArray("Zombies", "Plants", "Projectiles", "Structures", "Particles")]
|
||||||
script = ExtResource("3_6128b")
|
script = ExtResource("3_6128b")
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ public partial class Armor : Node
|
||||||
public delegate void ArmorLostEventHandler();
|
public delegate void ArmorLostEventHandler();
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
private int _maxHP;
|
public int MaxHP { get; private set; }
|
||||||
private int _hp;
|
private int _hp;
|
||||||
private bool _lost = false;
|
private bool _lost = false;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_hp = _maxHP;
|
_hp = MaxHP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int RecieveDamage(int damage)
|
public int RecieveDamage(int damage)
|
||||||
|
|
@ -43,10 +43,10 @@ public partial class Armor : Node
|
||||||
return amount;
|
return amount;
|
||||||
int returnAmount = 0;
|
int returnAmount = 0;
|
||||||
_hp += amount;
|
_hp += amount;
|
||||||
if (_hp >= _maxHP)
|
if (_hp >= MaxHP)
|
||||||
{
|
{
|
||||||
returnAmount = _hp-_maxHP;
|
returnAmount = _hp-MaxHP;
|
||||||
_hp = _maxHP;
|
_hp = MaxHP;
|
||||||
}
|
}
|
||||||
EmitSignal(SignalName.ArmorDamaged,_hp);
|
EmitSignal(SignalName.ArmorDamaged,_hp);
|
||||||
return returnAmount;
|
return returnAmount;
|
||||||
|
|
|
||||||
33
scripts/components/DegradingSprite.cs
Normal file
33
scripts/components/DegradingSprite.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
|
|
||||||
|
namespace Newlon.Components.Zombies;
|
||||||
|
|
||||||
|
public partial class DegradingSprite : Sprite2D
|
||||||
|
{
|
||||||
|
[Export] private Armor armor;
|
||||||
|
[Export] private Array<Texture2D> degradationStages;
|
||||||
|
[Export] private Array<float> thresholdPercentage;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
armor.ArmorDamaged += OnZombieHPChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnZombieHPChanged(int hp)
|
||||||
|
{
|
||||||
|
float percent = (float)hp / (float)armor.MaxHP;
|
||||||
|
for (int i = 0; i < degradationStages.Count; i++)
|
||||||
|
{
|
||||||
|
if (percent <= thresholdPercentage[i])
|
||||||
|
{
|
||||||
|
Texture = degradationStages[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
1
scripts/components/DegradingSprite.cs.uid
Normal file
1
scripts/components/DegradingSprite.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bbw848msxb4re
|
||||||
|
|
@ -1,13 +1,23 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Newlon.Components.GUI.Seedpackets;
|
||||||
|
|
||||||
namespace Newlon.Components.GUI;
|
namespace Newlon.Components.GUI;
|
||||||
|
|
||||||
public partial class VeilResizer : TextureProgressBar
|
public partial class VeilResizer : TextureProgressBar
|
||||||
{
|
{
|
||||||
[Export] private Timer _referenceTimer;
|
[Export] private Timer _referenceTimer;
|
||||||
|
private Seedpacket seedpacket;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
seedpacket = GetParent<Seedpacket>();
|
||||||
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
Value = (_referenceTimer.TimeLeft/_referenceTimer.WaitTime);
|
if (seedpacket.Disabled && _referenceTimer.IsStopped())
|
||||||
|
Value = 1.0;
|
||||||
|
else
|
||||||
|
Value = _referenceTimer.TimeLeft / _referenceTimer.WaitTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue