components #1
@ -1,6 +1,6 @@
|
||||
[gd_resource type="Resource" script_class="Character" load_steps=3 format=3 uid="uid://bd1ugbnlm08vv"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/resources/Character/Character.gd" id="1_8yb2m"]
|
||||
[ext_resource type="Script" path="res://scripts/resources/Character/CharacterResource.gd" id="1_8yb2m"]
|
||||
[ext_resource type="Resource" uid="uid://qcjre5wwbrs3" path="res://resources/PlayerStats.tres" id="2_rc7x1"]
|
||||
|
||||
[resource]
|
||||
|
||||
@ -9,5 +9,14 @@ shadow_enabled = true
|
||||
[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)
|
||||
|
||||
[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="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.901077, 0.433659, 0, -0.433659, 0.901077, 0, 1.21776, 2.12747)
|
||||
|
||||
7
scripts/Attachment.gd
Normal file
7
scripts/Attachment.gd
Normal file
@ -0,0 +1,7 @@
|
||||
class_name Attachment extends Node3D
|
||||
|
||||
|
||||
var stats: AttachmentStats
|
||||
|
||||
func init_attachment(stats: AttachmentStats):
|
||||
self.stats = stats;
|
||||
11
scripts/Character.gd
Normal file
11
scripts/Character.gd
Normal file
@ -0,0 +1,11 @@
|
||||
class_name Character extends Node3D
|
||||
|
||||
|
||||
var stats: CharacterStats
|
||||
var equipments: Array[Equipment]
|
||||
|
||||
func init_character(stats: CharacterStats):
|
||||
self.stats = stats;
|
||||
|
||||
func equip(newEquipment: Equipment)-> void:
|
||||
equipments.append(newEquipment)
|
||||
7
scripts/Equipment.gd
Normal file
7
scripts/Equipment.gd
Normal file
@ -0,0 +1,7 @@
|
||||
class_name Equipment extends Node3D
|
||||
|
||||
|
||||
var stats: EquipmentStats
|
||||
|
||||
func init_equipment(stats: EquipmentStats):
|
||||
self.stats = stats;
|
||||
1
scripts/PlayerCharacter.gd
Normal file
1
scripts/PlayerCharacter.gd
Normal file
@ -0,0 +1 @@
|
||||
class_name PlayerCharacter extends Character
|
||||
11
scripts/Weapon.gd
Normal file
11
scripts/Weapon.gd
Normal file
@ -0,0 +1,11 @@
|
||||
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)
|
||||
@ -1,5 +0,0 @@
|
||||
extends Resource
|
||||
|
||||
class_name Character
|
||||
|
||||
@export var stats: CharacterStats
|
||||
13
scripts/resources/Character/CharacterResource.gd
Normal file
13
scripts/resources/Character/CharacterResource.gd
Normal file
@ -0,0 +1,13 @@
|
||||
extends Resource
|
||||
|
||||
class_name CharacterResource
|
||||
|
||||
@export var character_stats: CharacterStats
|
||||
@export var character_scene: PackedScene
|
||||
|
||||
|
||||
func instantiate(parent: Node3D)->Character:
|
||||
var character_instance = character_scene.instantiate() as Character
|
||||
character_instance.init_character(character_stats)
|
||||
parent.add_child(character_instance)
|
||||
return character_instance
|
||||
17
scripts/resources/Character/Equipment/EquipmentResource.gd
Normal file
17
scripts/resources/Character/Equipment/EquipmentResource.gd
Normal file
@ -0,0 +1,17 @@
|
||||
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
|
||||
|
||||
func get_stats()-> EquipmentStats:
|
||||
return equipment_stats
|
||||
@ -7,3 +7,6 @@ class_name EquipmentStats
|
||||
@export var shield: Shield
|
||||
@export var movementSpeed: MovementSpeed
|
||||
@export var damage: Damage
|
||||
|
||||
func combine (other: EquipmentStats)->EquipmentStats:
|
||||
return null
|
||||
3
scripts/resources/Character/Equipment/MechParts/Arms.gd
Normal file
3
scripts/resources/Character/Equipment/MechParts/Arms.gd
Normal file
@ -0,0 +1,3 @@
|
||||
extends MechPartResource
|
||||
|
||||
class_name Arms
|
||||
3
scripts/resources/Character/Equipment/MechParts/Boots.gd
Normal file
3
scripts/resources/Character/Equipment/MechParts/Boots.gd
Normal file
@ -0,0 +1,3 @@
|
||||
extends MechPartResource
|
||||
|
||||
class_name Boots
|
||||
@ -0,0 +1,3 @@
|
||||
extends MechPartResource
|
||||
|
||||
class_name Hydraulics
|
||||
10
scripts/resources/Character/Equipment/MechParts/MechBase.gd
Normal file
10
scripts/resources/Character/Equipment/MechParts/MechBase.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends MechPartResource
|
||||
|
||||
class_name MechBase
|
||||
|
||||
@export var boots: Boots
|
||||
@export var arms: Arms
|
||||
@export var hydraulics: Hydraulics
|
||||
|
||||
func get_stats()-> EquipmentStats:
|
||||
return boots.equipment_stats.combine(arms.equipment_stats).combine(hydraulics.equipment_stats)
|
||||
@ -0,0 +1,3 @@
|
||||
extends EquipmentResource
|
||||
|
||||
class_name MechPartResource
|
||||
@ -1,3 +0,0 @@
|
||||
extends Character
|
||||
|
||||
@export var mech: MechBase
|
||||
@ -1,3 +0,0 @@
|
||||
extends MechPart
|
||||
|
||||
class_name Arms
|
||||
@ -1,3 +0,0 @@
|
||||
extends MechPart
|
||||
|
||||
class_name Boots
|
||||
@ -1,3 +0,0 @@
|
||||
extends MechPart
|
||||
|
||||
class_name Hydraulics
|
||||
@ -1,7 +0,0 @@
|
||||
extends MechPart
|
||||
|
||||
class_name MechBase
|
||||
|
||||
@export var boots: Boots
|
||||
@export var arms: Arms
|
||||
@export var hydraulics: Hydraulics
|
||||
@ -1,6 +0,0 @@
|
||||
extends Resource
|
||||
|
||||
class_name MechPart
|
||||
|
||||
@export var name: String
|
||||
@export var stats: EquipmentStats
|
||||
13
scripts/resources/Stats/FireRate.gd
Normal file
13
scripts/resources/Stats/FireRate.gd
Normal file
@ -0,0 +1,13 @@
|
||||
extends Resource
|
||||
|
||||
class_name FireRate
|
||||
|
||||
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/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
|
||||
6
scripts/resources/Weapons/Attachments/AttachmentStats.gd
Normal file
6
scripts/resources/Weapons/Attachments/AttachmentStats.gd
Normal file
@ -0,0 +1,6 @@
|
||||
extends Resource
|
||||
|
||||
class_name AttachmentStats
|
||||
|
||||
@export var damage: Damage
|
||||
@export var fire_rate: FireRate
|
||||
@ -1,5 +0,0 @@
|
||||
extends Resource
|
||||
|
||||
class_name Weapon
|
||||
|
||||
@export var name: String
|
||||
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
|
||||
@ -4,3 +4,4 @@ class_name WeaponStats
|
||||
|
||||
|
||||
@export var damage: Damage
|
||||
@export var fire_rate: FireRate
|
||||
|
||||
Loading…
Reference in New Issue
Block a user