Ready to work on actual logic for battles.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
class_name BattleSingleton extends Node
|
||||
const BattleCutsceneAction = preload("res://cutscene/battle/BattleCutsceneAction.gd")
|
||||
|
||||
enum BattlePosition {
|
||||
LEFT_TOP_BACK,
|
||||
@@ -17,6 +16,17 @@ enum BattlePosition {
|
||||
RIGHT_BOTTOM_FRONT
|
||||
}
|
||||
|
||||
static func isPositionRight(battlePos:BattlePosition) -> bool:
|
||||
return battlePos in [
|
||||
BattlePosition.RIGHT_TOP_BACK,
|
||||
BattlePosition.RIGHT_TOP_FRONT,
|
||||
BattlePosition.RIGHT_MIDDLE_BACK,
|
||||
BattlePosition.RIGHT_MIDDLE_FRONT,
|
||||
BattlePosition.RIGHT_BOTTOM_BACK,
|
||||
BattlePosition.RIGHT_BOTTOM_FRONT
|
||||
]
|
||||
|
||||
|
||||
# Battle State
|
||||
var active:bool = false
|
||||
var fighterMap:Dictionary[BattlePosition, BattleFighter] = {}
|
||||
|
||||
@@ -3,6 +3,7 @@ class_name BattleFighterScene extends Node3D
|
||||
@export var battlePosition:BattleSingleton.BattlePosition = BattleSingleton.BattlePosition.LEFT_MIDDLE_FRONT
|
||||
@export var damageLabels:Node3D
|
||||
@export var damageLabelPreset:PackedScene
|
||||
@export var sprite:AnimatedSprite3D
|
||||
|
||||
var currentFighter:BattleFighter = null
|
||||
|
||||
@@ -22,6 +23,13 @@ func _updateFighter() -> void:
|
||||
currentFighter.healthChanged.connect(onDamageTaken)
|
||||
self.visible = true
|
||||
|
||||
# Update left/right orientation
|
||||
if sprite != null:
|
||||
if BattleSingleton.isPositionRight(battlePosition):
|
||||
sprite.flip_h = true
|
||||
else:
|
||||
sprite.flip_h = false
|
||||
|
||||
func _enter_tree() -> void:
|
||||
BATTLE.battleFightersChanged.connect(onFightersChanged)
|
||||
self._updateFighter()
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e55p4"]
|
||||
shading_mode = 0
|
||||
|
||||
[node name="BattleFighterScene" type="Node3D" node_paths=PackedStringArray("damageLabels")]
|
||||
[node name="BattleFighterScene" type="Node3D" node_paths=PackedStringArray("damageLabels", "sprite")]
|
||||
script = ExtResource("1_veb1i")
|
||||
damageLabels = NodePath("Labels")
|
||||
damageLabelPreset = ExtResource("2_lciku")
|
||||
sprite = NodePath("AnimatedSprite3D")
|
||||
metadata/_custom_type_script = "uid://bgycdhsouwhwt"
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
|
||||
Reference in New Issue
Block a user