Initial commit
This commit is contained in:
19
actors/Components/HitBox.gd
Normal file
19
actors/Components/HitBox.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends Area3D
|
||||
class_name HitBox
|
||||
|
||||
@export var active: bool = false
|
||||
var attack: Attack
|
||||
|
||||
func _ready() -> void:
|
||||
monitorable = false
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if !attack: return
|
||||
|
||||
var boxesHurt: Array[HurtBox]
|
||||
for area in get_overlapping_areas():
|
||||
if area is HurtBox:
|
||||
boxesHurt.push_back(area)
|
||||
|
||||
for box in boxesHurt:
|
||||
box.hit(attack)
|
||||
1
actors/Components/HitBox.gd.uid
Normal file
1
actors/Components/HitBox.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c4bkcld6mpuj7
|
||||
10
actors/Components/HurtBox.gd
Normal file
10
actors/Components/HurtBox.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends Area3D
|
||||
class_name HurtBox
|
||||
|
||||
signal hitTaken(attack: Attack)
|
||||
|
||||
func _ready() -> void:
|
||||
monitoring = false
|
||||
|
||||
func hit(attack: Attack) -> void: ##Emits hitTaken signal to indicate the actor has been hit by an attack
|
||||
hitTaken.emit(attack)
|
||||
1
actors/Components/HurtBox.gd.uid
Normal file
1
actors/Components/HurtBox.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b7kjt28lv4p1h
|
||||
5
actors/Components/attack.gd
Normal file
5
actors/Components/attack.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Object
|
||||
class_name Attack
|
||||
|
||||
var damage: float = 0.0
|
||||
var trauma: float = 0.0
|
||||
1
actors/Components/attack.gd.uid
Normal file
1
actors/Components/attack.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://vj6t63oapvo4
|
||||
Reference in New Issue
Block a user