waited far too long for an initial commit but here we are
This commit is contained in:
19
PCs/Universal/ClassCards/Assault/card_assault.tres
Normal file
19
PCs/Universal/ClassCards/Assault/card_assault.tres
Normal file
@ -0,0 +1,19 @@
|
||||
[gd_resource type="Resource" script_class="Card" load_steps=7 format=3 uid="uid://bmoreipvttks8"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/card.gd" id="1_yqa4b"]
|
||||
[ext_resource type="Texture2D" uid="uid://ca4lwwd3e0y73" path="res://Assets/TextureAtlases/g_assault.tres" id="2_8j5h0"]
|
||||
[ext_resource type="PackedScene" uid="uid://fernyl7fsifv" path="res://PCs/Universal/ClassCards/Assault/tower_assault.tscn" id="3_0r6s7"]
|
||||
[ext_resource type="Resource" uid="uid://w15ojqyxd72q" path="res://Resources/WeaponStats/assault.tres" id="3_k2yr3"]
|
||||
[ext_resource type="Resource" uid="uid://cktq4o3yuxgsa" path="res://Resources/TurretStats/assault.tres" id="3_p4byc"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1xe6hsq05110" path="res://PCs/Universal/ClassCards/Assault/weapon_assault.tscn" id="3_wj5gm"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_yqa4b")
|
||||
title = "Assault"
|
||||
rarity = 0
|
||||
faction = 0
|
||||
sprite = ExtResource("2_8j5h0")
|
||||
turret = ExtResource("3_0r6s7")
|
||||
weapon = ExtResource("3_wj5gm")
|
||||
weapon_stats = ExtResource("3_k2yr3")
|
||||
tower_stats = ExtResource("3_p4byc")
|
45
PCs/Universal/ClassCards/Assault/tower.gd
Normal file
45
PCs/Universal/ClassCards/Assault/tower.gd
Normal file
@ -0,0 +1,45 @@
|
||||
extends Node3D
|
||||
class_name Tower
|
||||
|
||||
@export var stats : TowerStats
|
||||
@export var model : Node3D
|
||||
|
||||
var targeted_enemy
|
||||
var cooldown := 0.0
|
||||
var other_cooldown := 0.0
|
||||
|
||||
func _ready() -> void:
|
||||
cooldown = 1.0 / stats.fire_rate
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
other_cooldown -= delta
|
||||
if !targeted_enemy:
|
||||
acquire_target()
|
||||
else:
|
||||
if model.global_position.distance_to(targeted_enemy.global_position) > stats.fire_range:
|
||||
targeted_enemy = null
|
||||
if targeted_enemy:
|
||||
aim()
|
||||
if other_cooldown <= 0:
|
||||
shoot()
|
||||
other_cooldown = cooldown
|
||||
|
||||
|
||||
func shoot():
|
||||
targeted_enemy.damage(stats.damage)
|
||||
|
||||
|
||||
func aim():
|
||||
model.look_at(targeted_enemy.global_position)
|
||||
|
||||
|
||||
func acquire_target():
|
||||
var most_progressed_enemy = null
|
||||
for enemy in get_tree().get_nodes_in_group("Enemies"):
|
||||
if model.global_position.distance_to(enemy.global_position) > stats.fire_range:
|
||||
continue
|
||||
if (most_progressed_enemy == null or enemy.progress >= most_progressed_enemy.progress) and enemy.stats.target_type & stats.can_target:
|
||||
most_progressed_enemy = enemy
|
||||
if most_progressed_enemy != null:
|
||||
targeted_enemy = most_progressed_enemy
|
22
PCs/Universal/ClassCards/Assault/tower_assault.tscn
Normal file
22
PCs/Universal/ClassCards/Assault/tower_assault.tscn
Normal file
@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://fernyl7fsifv"]
|
||||
|
||||
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Assault/tower.gd" id="1_c2874"]
|
||||
[ext_resource type="Resource" uid="uid://cktq4o3yuxgsa" path="res://Resources/TurretStats/assault.tres" id="2_t516u"]
|
||||
|
||||
[node name="Node3D" type="Node3D" node_paths=PackedStringArray("model")]
|
||||
script = ExtResource("1_c2874")
|
||||
stats = ExtResource("2_t516u")
|
||||
model = NodePath("Model")
|
||||
|
||||
[node name="Model" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="Model"]
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="Model"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.714825, 0, -0.423869)
|
||||
size = Vector3(0.481654, 0.427749, 1.38438)
|
||||
|
||||
[node name="CSGBox3D3" type="CSGBox3D" parent="Model"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.715, 0, -0.424)
|
||||
size = Vector3(0.481654, 0.427749, 1.38438)
|
66
PCs/Universal/ClassCards/Assault/weapon.gd
Normal file
66
PCs/Universal/ClassCards/Assault/weapon.gd
Normal file
@ -0,0 +1,66 @@
|
||||
extends Sprite3D
|
||||
class_name Weapon
|
||||
|
||||
@export var stats : WeaponStats
|
||||
@export var hero : Hero
|
||||
|
||||
var cooldown := 0.0
|
||||
var other_cooldown := 0.0
|
||||
var trigger_held := false
|
||||
var second_trigger_held := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
cooldown = 1.0 / stats.fire_rate
|
||||
$RayCast3D.target_position = Vector3(0, 0, -stats.fire_range)
|
||||
|
||||
|
||||
func set_raycast_origin(node):
|
||||
$RayCast3D.global_position = node.global_position
|
||||
|
||||
|
||||
func set_hero(value):
|
||||
hero = value
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if stats != null:
|
||||
other_cooldown -= delta
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if trigger_held:
|
||||
shoot()
|
||||
|
||||
|
||||
func hold_trigger():
|
||||
trigger_held = true
|
||||
|
||||
|
||||
func release_trigger():
|
||||
trigger_held = false
|
||||
|
||||
|
||||
func hold_second_trigger():
|
||||
second_trigger_held = true
|
||||
|
||||
|
||||
func release_second_trigger():
|
||||
second_trigger_held = false
|
||||
|
||||
|
||||
func shoot():
|
||||
if other_cooldown <= 0 and stats != null:
|
||||
other_cooldown = cooldown
|
||||
$AnimationPlayer.play("shoot")
|
||||
if $RayCast3D.is_colliding():
|
||||
var target = $RayCast3D.get_collider()
|
||||
if target != null:
|
||||
var target_hitbox = target.shape_owner_get_owner($RayCast3D.get_collider_shape())
|
||||
if target_hitbox is Hitbox:
|
||||
target_hitbox.damage(stats.damage)
|
||||
|
||||
@rpc
|
||||
func networked_shoot():
|
||||
$AnimationPlayer.play("shoot")
|
||||
|
58
PCs/Universal/ClassCards/Assault/weapon_assault.tscn
Normal file
58
PCs/Universal/ClassCards/Assault/weapon_assault.tscn
Normal file
@ -0,0 +1,58 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://d1xe6hsq05110"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ca4lwwd3e0y73" path="res://Assets/TextureAtlases/g_assault.tres" id="1_117ne"]
|
||||
[ext_resource type="Script" path="res://PCs/Universal/ClassCards/Assault/weapon.gd" id="2_4ie8w"]
|
||||
[ext_resource type="Resource" uid="uid://w15ojqyxd72q" path="res://Resources/WeaponStats/assault.tres" id="3_s4ckt"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_n8b32"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture:region")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Rect2(0, 0, 64, 64)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_g0h8q"]
|
||||
resource_name = "shoot"
|
||||
length = 0.15
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:texture:region")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.15),
|
||||
"transitions": PackedFloat32Array(0, 0),
|
||||
"update": 0,
|
||||
"values": [Rect2(64, 0, 64, 64), Rect2(0, 0, 64, 64)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ntl6p"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_n8b32"),
|
||||
"shoot": SubResource("Animation_g0h8q")
|
||||
}
|
||||
|
||||
[node name="Weapon" type="Sprite3D"]
|
||||
layers = 2
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = ExtResource("1_117ne")
|
||||
script = ExtResource("2_4ie8w")
|
||||
stats = ExtResource("3_s4ckt")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_ntl6p")
|
||||
}
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
collision_mask = 4
|
Reference in New Issue
Block a user