first version of enitites damageables weapons item and effects workflow
This commit is contained in:
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
|
||||
|
||||
Reference in New Issue
Block a user