Compare commits
5 Commits
develop
...
components
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb65c3a266 | ||
|
|
b90e0369bf | ||
|
|
ed2249bdce | ||
|
|
a1b0e6b5e7 | ||
|
|
5c88f4ed48 |
@ -30,7 +30,8 @@ config/icon="res://icon.svg"
|
|||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
DebugUi="*res://scenes/debug_ui/debug_ui.tscn"
|
MathUtils="*res://singeltons/MathUtils.gd"
|
||||||
|
DamageHandler="*res://singeltons/DamageHandler.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
@ -78,11 +79,6 @@ turn_right={
|
|||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
show_debug_ui={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|||||||
36
resources/PlayerStats.tres
Normal file
36
resources/PlayerStats.tres
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
[gd_resource type="Resource" script_class="EntityStats" load_steps=12 format=3 uid="uid://qcjre5wwbrs3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/resources/Stats/ArmorStat.gd" id="1_c7135"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/resources/Entity/EntityStats.gd" id="1_xti0a"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/resources/Stats/HealthStat.gd" id="2_hsnpy"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/resources/Stats/MaxHealthStat.gd" id="3_26tso"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/resources/Stats/MovementSpeedStat.gd" id="4_goc2a"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/resources/Stats/ShieldStat.gd" id="6_rncik"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_vbm44"]
|
||||||
|
script = ExtResource("1_c7135")
|
||||||
|
_value = 0
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_nyvlf"]
|
||||||
|
script = ExtResource("2_hsnpy")
|
||||||
|
_value = 0
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_pxuuc"]
|
||||||
|
script = ExtResource("3_26tso")
|
||||||
|
_value = 10
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_vs6ff"]
|
||||||
|
script = ExtResource("4_goc2a")
|
||||||
|
_value = 0
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_r5hb1"]
|
||||||
|
script = ExtResource("6_rncik")
|
||||||
|
_value = 0
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_xti0a")
|
||||||
|
max_health = SubResource("Resource_pxuuc")
|
||||||
|
health = SubResource("Resource_nyvlf")
|
||||||
|
armor = SubResource("Resource_vbm44")
|
||||||
|
shield = SubResource("Resource_r5hb1")
|
||||||
|
movementSpeed = SubResource("Resource_vs6ff")
|
||||||
@ -9,5 +9,14 @@ shadow_enabled = true
|
|||||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||||
transform = Transform3D(0.804543, 0.301369, -0.511748, -0.471444, 0.848123, -0.241718, 0.361179, 0.435734, 0.824431, 0, 0, 0)
|
transform = Transform3D(0.804543, 0.301369, -0.511748, -0.471444, 0.848123, -0.241718, 0.361179, 0.435734, 0.824431, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="CSGBox3D"]
|
||||||
|
transform = Transform3D(0.804543, 0.301369, -0.511748, -0.471444, 0.848123, -0.241718, 0.361179, 0.435734, 0.824431, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="CSGBox3D/CSGBox3D"]
|
||||||
|
transform = Transform3D(0.804543, 0.301369, -0.511748, -0.471444, 0.848123, -0.241718, 0.361179, 0.435734, 0.824431, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="CSGBox3D/CSGBox3D/CSGBox3D"]
|
||||||
|
transform = Transform3D(0.804543, 0.301369, -0.511748, -0.471444, 0.848123, -0.241718, 0.361179, 0.435734, 0.824431, 0, 0, 0)
|
||||||
|
|
||||||
[node name="Camera3D" type="Camera3D" parent="."]
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 0.901077, 0.433659, 0, -0.433659, 0.901077, 0, 1.21776, 2.12747)
|
transform = Transform3D(1, 0, 0, 0, 0.901077, 0.433659, 0, -0.433659, 0.901077, 0, 1.21776, 2.12747)
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
extends Control
|
|
||||||
|
|
||||||
@export var show_debug_ui: bool = true
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
|
||||||
if event.is_action_pressed("show_debug_ui"):
|
|
||||||
show_debug_ui = !show_debug_ui
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
if show_debug_ui:
|
|
||||||
DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn())
|
|
||||||
DebugDraw2D.set_text("FPS", Engine.get_frames_per_second())
|
|
||||||
DebugDraw2D.set_text("delta", delta)
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://clcnavxmm7eae"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/debug_ui/debug_ui.gd" id="1_24u3s"]
|
|
||||||
|
|
||||||
[node name="DebugUi" type="Control"]
|
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
script = ExtResource("1_24u3s")
|
|
||||||
1
scripts/Entites/Enemie.gd
Normal file
1
scripts/Entites/Enemie.gd
Normal file
@ -0,0 +1 @@
|
|||||||
|
class_name Enemie extends Entity
|
||||||
70
scripts/Entites/Entity.gd
Normal file
70
scripts/Entites/Entity.gd
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
class_name Entity extends Node3D
|
||||||
|
|
||||||
|
|
||||||
|
var stats: EntityStats
|
||||||
|
var equipments: Array[Equipment]
|
||||||
|
signal died_event(entity: Entity)
|
||||||
|
|
||||||
|
func init_entity(stats: EntityStats):
|
||||||
|
self.stats = stats;
|
||||||
|
|
||||||
|
func equip(newEquipment: Equipment)-> void:
|
||||||
|
equipments.append(newEquipment)
|
||||||
|
|
||||||
|
func unequip(equipmentToRemove: Equipment)-> void:
|
||||||
|
equipments.erase(equipmentToRemove)
|
||||||
|
|
||||||
|
|
||||||
|
func get_health()->int:
|
||||||
|
return stats.health.value
|
||||||
|
|
||||||
|
func get_shield()->int:
|
||||||
|
return stats.shield.value
|
||||||
|
|
||||||
|
func reduce_shield(damage: int):
|
||||||
|
stats.shield.value -= damage
|
||||||
|
if stats.shield.value <= 0:
|
||||||
|
stats.shield.value = 0
|
||||||
|
|
||||||
|
func increase_health(additional_health: int):
|
||||||
|
stats.health.value += additional_health
|
||||||
|
if stats.health.value > get_max_health():
|
||||||
|
stats.health.value = get_max_health()
|
||||||
|
|
||||||
|
func reduce_health(damage: int):
|
||||||
|
stats.health.value -= damage
|
||||||
|
if stats.health.value <= 0:
|
||||||
|
died()
|
||||||
|
|
||||||
|
func died():
|
||||||
|
died_event.emit(self)
|
||||||
|
|
||||||
|
func get_max_health()->int:
|
||||||
|
var max_health = stats.max_health
|
||||||
|
for equipment in equipments:
|
||||||
|
max_health += equipment.get_max_health()
|
||||||
|
return max_health
|
||||||
|
|
||||||
|
func get_armor()->int:
|
||||||
|
var armor = stats.armor
|
||||||
|
for equipment in equipments:
|
||||||
|
armor += equipment.get_armor()
|
||||||
|
return armor
|
||||||
|
|
||||||
|
func get_max_Shield()->int:
|
||||||
|
var shield = stats.shield
|
||||||
|
for equipment in equipments:
|
||||||
|
shield += equipment.get_max_shield()
|
||||||
|
return shield
|
||||||
|
|
||||||
|
func get_movement_speed()->int:
|
||||||
|
var movement_speed = stats.movement_speed
|
||||||
|
for equipment in equipments:
|
||||||
|
movement_speed += equipment.get_evement_speed()
|
||||||
|
return movement_speed
|
||||||
|
|
||||||
|
func get_damage()->int:
|
||||||
|
var damage = 0
|
||||||
|
for equipment in equipments:
|
||||||
|
damage += equipment.get_damage()
|
||||||
|
return damage
|
||||||
19
scripts/Entites/PlayerCharacter.gd
Normal file
19
scripts/Entites/PlayerCharacter.gd
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
class_name PlayerCharacter extends Entity
|
||||||
|
|
||||||
|
var mech: Mech
|
||||||
|
|
||||||
|
func init_player_character(stats: EntityStats, mech: Mech):
|
||||||
|
init_entity(stats)
|
||||||
|
self.mech = mech;
|
||||||
|
|
||||||
|
func get_max_health() -> int:
|
||||||
|
return super() + mech.get_max_health()
|
||||||
|
|
||||||
|
func get_armor() -> int:
|
||||||
|
return super() + mech.get_armor()
|
||||||
|
|
||||||
|
func get_max_Shield() -> int:
|
||||||
|
return super() + mech.get_shield()
|
||||||
|
|
||||||
|
func get_movement_speed() -> int:
|
||||||
|
return super() + mech.get_movement_speed()
|
||||||
16
scripts/Items/Attachment.gd
Normal file
16
scripts/Items/Attachment.gd
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
class_name Attachment extends Node3D
|
||||||
|
|
||||||
|
|
||||||
|
var stats: AttachmentStats
|
||||||
|
|
||||||
|
func init_attachment(stats: AttachmentStats):
|
||||||
|
self.stats = stats
|
||||||
|
|
||||||
|
func get_damage()->int:
|
||||||
|
return stats.damage.value
|
||||||
|
|
||||||
|
func get_fire_rate()->int:
|
||||||
|
return stats.fire_rate.value
|
||||||
|
|
||||||
|
func get_hit_effects()-> Array[Effect]:
|
||||||
|
return stats.hit_effects.value
|
||||||
22
scripts/Items/Equipment.gd
Normal file
22
scripts/Items/Equipment.gd
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class_name Equipment extends Node3D
|
||||||
|
|
||||||
|
|
||||||
|
var stats: EquipmentStats
|
||||||
|
|
||||||
|
func init_equipment(stats: EquipmentStats):
|
||||||
|
self.stats = stats;
|
||||||
|
|
||||||
|
func get_armor()-> int:
|
||||||
|
return stats.armor.value
|
||||||
|
|
||||||
|
func get_max_health()-> int:
|
||||||
|
return stats.max_health.value
|
||||||
|
|
||||||
|
func get_max_shield()-> int:
|
||||||
|
return stats.max_shield.value
|
||||||
|
|
||||||
|
func get_evement_speed()-> int:
|
||||||
|
return stats.movementSpeed.value
|
||||||
|
|
||||||
|
func get_damage()-> int:
|
||||||
|
return stats.damage.value
|
||||||
1
scripts/Items/Mech/Arms.gd
Normal file
1
scripts/Items/Mech/Arms.gd
Normal file
@ -0,0 +1 @@
|
|||||||
|
class_name Arms extends Equipment
|
||||||
1
scripts/Items/Mech/Boots.gd
Normal file
1
scripts/Items/Mech/Boots.gd
Normal file
@ -0,0 +1 @@
|
|||||||
|
class_name Boots extends Equipment
|
||||||
1
scripts/Items/Mech/Hydraulics.gd
Normal file
1
scripts/Items/Mech/Hydraulics.gd
Normal file
@ -0,0 +1 @@
|
|||||||
|
class_name Hydraulics extends Equipment
|
||||||
28
scripts/Items/Mech/Mech.gd
Normal file
28
scripts/Items/Mech/Mech.gd
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
class_name Mech
|
||||||
|
|
||||||
|
var boots: Boots
|
||||||
|
var arms: Arms
|
||||||
|
var hydraulics: Hydraulics
|
||||||
|
|
||||||
|
|
||||||
|
func init_mech(boots: Boots, arms: Arms, hydraulics: Hydraulics):
|
||||||
|
self.boots = boots
|
||||||
|
self.arms = arms
|
||||||
|
self.hydraulics= hydraulics
|
||||||
|
|
||||||
|
func get_max_health()-> int:
|
||||||
|
return boots.get_max_health() +arms.get_max_health()+hydraulics.get_max_health()
|
||||||
|
|
||||||
|
func get_armor()-> int:
|
||||||
|
return boots.get_armor()+arms.get_armor()+hydraulics.get_armor()
|
||||||
|
|
||||||
|
func get_max_shield()-> int:
|
||||||
|
return boots.get_max_shield()+arms.get_max_shield()+hydraulics.get_max_shield()
|
||||||
|
|
||||||
|
func get_damage()-> int:
|
||||||
|
return boots.get_damage()+arms.get_damage()+hydraulics.get_damage()
|
||||||
|
|
||||||
|
func get_movement_speed()-> int:
|
||||||
|
return boots.get_evement_speed()+arms.get_evement_speed()+hydraulics.get_evement_speed()
|
||||||
33
scripts/Items/Weapon.gd
Normal file
33
scripts/Items/Weapon.gd
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
class_name Weapon extends Node3D
|
||||||
|
|
||||||
|
var stats: WeaponStats
|
||||||
|
var attachments: Array[Attachment]
|
||||||
|
|
||||||
|
func init_weapon(stats: WeaponStats):
|
||||||
|
self.stats = stats;
|
||||||
|
|
||||||
|
func attach(newAttachment: Attachment)-> void:
|
||||||
|
attachments.append(newAttachment)
|
||||||
|
|
||||||
|
func unattach(attachmentToRemove: Attachment)-> void:
|
||||||
|
attachments.erase(attachmentToRemove)
|
||||||
|
|
||||||
|
func get_damage()->int:
|
||||||
|
var damage = stats.damage
|
||||||
|
for attachment in attachments:
|
||||||
|
damage += attachment.get_damage()
|
||||||
|
return damage
|
||||||
|
|
||||||
|
func get_fire_rate()->int:
|
||||||
|
var fire_rate = stats.fire_rate
|
||||||
|
for attachment in attachments:
|
||||||
|
fire_rate += attachment.get_fire_rate()
|
||||||
|
return fire_rate
|
||||||
|
|
||||||
|
func get_hit_effects()-> Array[Effect]:
|
||||||
|
var hit_effects = []
|
||||||
|
hit_effects.append_array(stats.hit_effects.value)
|
||||||
|
for attachment in attachments:
|
||||||
|
hit_effects.append_array(attachment.get_hit_effects())
|
||||||
|
return hit_effects
|
||||||
|
|
||||||
6
scripts/resources/Effects/Effect.gd
Normal file
6
scripts/resources/Effects/Effect.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name Effect
|
||||||
|
|
||||||
|
func apply_effect (orign_entity: Entity, target_entity: Entity)-> void:
|
||||||
|
assert(false)
|
||||||
6
scripts/resources/Effects/HealEffect.gd
Normal file
6
scripts/resources/Effects/HealEffect.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class_name HealEffect extends Effect
|
||||||
|
|
||||||
|
@export var heal_amount: int
|
||||||
|
|
||||||
|
func apply_effect (orign_entity: Entity, target_entity: Entity)-> void:
|
||||||
|
target_entity.increase_health(heal_amount)
|
||||||
13
scripts/resources/Entity/EntityResource.gd
Normal file
13
scripts/resources/Entity/EntityResource.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name EntityResource
|
||||||
|
|
||||||
|
@export var entity_stats: EntityStats
|
||||||
|
@export var entity_scene: PackedScene
|
||||||
|
|
||||||
|
|
||||||
|
func instantiate(parent: Node3D)->Entity:
|
||||||
|
var entity_instance = entity_scene.instantiate() as Entity
|
||||||
|
entity_instance.init_entity(entity_stats)
|
||||||
|
parent.add_child(entity_instance)
|
||||||
|
return entity_instance
|
||||||
10
scripts/resources/Entity/EntityStats.gd
Normal file
10
scripts/resources/Entity/EntityStats.gd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name EntityStats
|
||||||
|
|
||||||
|
@export var max_health: MaxHealthStat
|
||||||
|
@export var health: HealthStat
|
||||||
|
@export var armor: ArmorStat
|
||||||
|
@export var shield: ShieldStat
|
||||||
|
@export var max_shield: MaxShieldStat
|
||||||
|
@export var movementSpeed: MovementSpeedStat
|
||||||
14
scripts/resources/Equipment/EquipmentResource.gd
Normal file
14
scripts/resources/Equipment/EquipmentResource.gd
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name EquipmentResource
|
||||||
|
|
||||||
|
@export var name: String
|
||||||
|
@export var equipment_stats: EquipmentStats
|
||||||
|
@export var equipment_scene: PackedScene
|
||||||
|
|
||||||
|
|
||||||
|
func instantiate(parent: Node3D)->Equipment:
|
||||||
|
var equipment_instance = equipment_scene.instantiate() as Equipment
|
||||||
|
equipment_instance.init_Equipment(equipment_stats)
|
||||||
|
parent.add_child(equipment_instance)
|
||||||
|
return equipment_instance
|
||||||
9
scripts/resources/Equipment/EquipmentStats.gd
Normal file
9
scripts/resources/Equipment/EquipmentStats.gd
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name EquipmentStats
|
||||||
|
|
||||||
|
@export var max_health: MaxHealthStat
|
||||||
|
@export var armor: ArmorStat
|
||||||
|
@export var max_shield: MaxShieldStat
|
||||||
|
@export var movementSpeed: MovementSpeedStat
|
||||||
|
@export var damage: DamageStat
|
||||||
3
scripts/resources/Equipment/MechParts/ArmsResource.gd
Normal file
3
scripts/resources/Equipment/MechParts/ArmsResource.gd
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
extends MechPartResource
|
||||||
|
|
||||||
|
class_name ArmsResource
|
||||||
3
scripts/resources/Equipment/MechParts/BootsResource.gd
Normal file
3
scripts/resources/Equipment/MechParts/BootsResource.gd
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
extends MechPartResource
|
||||||
|
|
||||||
|
class_name BootsResource
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
extends MechPartResource
|
||||||
|
|
||||||
|
class_name HydraulicsResource
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
extends EquipmentResource
|
||||||
|
|
||||||
|
class_name MechPartResource
|
||||||
13
scripts/resources/Stats/ArmorStat.gd
Normal file
13
scripts/resources/Stats/ArmorStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name ArmorStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentArmor: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/DamageStat.gd
Normal file
13
scripts/resources/Stats/DamageStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name DamageStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentDamage: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/Effects/HitEffectsStat.gd
Normal file
13
scripts/resources/Stats/Effects/HitEffectsStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name HitEffectStat
|
||||||
|
|
||||||
|
signal value_changed_signal(effects: Array[Effect])
|
||||||
|
|
||||||
|
@export var _value: Array[Effect]
|
||||||
|
var value: Array[Effect]:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/FireRateStat.gd
Normal file
13
scripts/resources/Stats/FireRateStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name FireRateStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentFireRate: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/HealthStat.gd
Normal file
13
scripts/resources/Stats/HealthStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name HealthStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentHealth: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/MaxHealthStat.gd
Normal file
13
scripts/resources/Stats/MaxHealthStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name MaxHealthStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentMaxHealth: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/MaxShieldStat.gd
Normal file
13
scripts/resources/Stats/MaxShieldStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name MaxShieldStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentMaxShield: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/MovementSpeedStat.gd
Normal file
13
scripts/resources/Stats/MovementSpeedStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name MovementSpeedStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentMovementSpeed: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Stats/ShieldStat.gd
Normal file
13
scripts/resources/Stats/ShieldStat.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name ShieldStat
|
||||||
|
|
||||||
|
signal value_changed_signal(currentShield: int)
|
||||||
|
|
||||||
|
@export var _value: int
|
||||||
|
var value: int:
|
||||||
|
get:
|
||||||
|
return _value
|
||||||
|
set(new_value):
|
||||||
|
value = new_value;
|
||||||
|
value_changed_signal.emit(_value)
|
||||||
13
scripts/resources/Weapons/Attachments/AttachmentResource.gd
Normal file
13
scripts/resources/Weapons/Attachments/AttachmentResource.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name AttachmentResource
|
||||||
|
|
||||||
|
@export var attachment_stats: AttachmentStats
|
||||||
|
@export var attachment_scene: PackedScene
|
||||||
|
|
||||||
|
|
||||||
|
func instantiate(parent: Node3D)->Attachment:
|
||||||
|
var attachment_instance = attachment_scene.instantiate() as Attachment
|
||||||
|
attachment_instance.init_Attachment(attachment_stats)
|
||||||
|
parent.add_child(attachment_instance)
|
||||||
|
return attachment_instance
|
||||||
7
scripts/resources/Weapons/Attachments/AttachmentStats.gd
Normal file
7
scripts/resources/Weapons/Attachments/AttachmentStats.gd
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name AttachmentStats
|
||||||
|
|
||||||
|
@export var damage: DamageStat
|
||||||
|
@export var fire_rate: FireRateStat
|
||||||
|
@export var hit_effects: HitEffectStat
|
||||||
13
scripts/resources/Weapons/WeaponResource.gd
Normal file
13
scripts/resources/Weapons/WeaponResource.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name WeaponResource
|
||||||
|
|
||||||
|
@export var name: String
|
||||||
|
@export var weapon_stats: WeaponStats
|
||||||
|
@export var weapon_scene: PackedScene
|
||||||
|
|
||||||
|
func instantiate(parent: Node3D)->Weapon:
|
||||||
|
var weapon_instance = weapon_scene.instantiate() as Weapon
|
||||||
|
weapon_instance.init_weapon(weapon_stats)
|
||||||
|
parent.add_child(weapon_instance)
|
||||||
|
return weapon_instance
|
||||||
8
scripts/resources/Weapons/WeaponStats.gd
Normal file
8
scripts/resources/Weapons/WeaponStats.gd
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name WeaponStats
|
||||||
|
|
||||||
|
|
||||||
|
@export var damage: DamageStat
|
||||||
|
@export var fire_rate: FireRateStat
|
||||||
|
@export var hit_effects: HitEffectStat
|
||||||
20
singeltons/DamageHandler.gd
Normal file
20
singeltons/DamageHandler.gd
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
extends Object
|
||||||
|
|
||||||
|
func apply_damage(damage_dealer: Entity, damage_receiver: Entity, weapon: Weapon ):
|
||||||
|
var damage = weapon.get_damage() + damage_dealer.get_damage()
|
||||||
|
var armor = damage_receiver.get_armor()
|
||||||
|
var damage_percent = 90*( pow(MathUtils.e, 0.03*armor))
|
||||||
|
|
||||||
|
var damage_after_armor = damage * damage_percent
|
||||||
|
if damage_after_armor < 1 :
|
||||||
|
damage_after_armor = 1
|
||||||
|
|
||||||
|
var shield = damage_receiver.get_shield()
|
||||||
|
if shield > 0:
|
||||||
|
damage_receiver.reduce_shield(damage_after_armor)
|
||||||
|
else:
|
||||||
|
damage_receiver.reduce_health(damage_after_armor)
|
||||||
|
|
||||||
|
for effect in weapon.get_hit_effects():
|
||||||
|
effect.apply_effect(damage_dealer,damage_receiver)
|
||||||
|
|
||||||
3
singeltons/MathUtils.gd
Normal file
3
singeltons/MathUtils.gd
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
extends Object
|
||||||
|
|
||||||
|
var e = 2.718281828459045235360287471352
|
||||||
@ -1 +1,7 @@
|
|||||||
extends Node3D
|
extends Node3D
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn())
|
||||||
|
DebugDraw2D.set_text("FPS", Engine.get_frames_per_second())
|
||||||
|
DebugDraw2D.set_text("delta", delta)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user