Refactoring action system
parent
7e599a5f97
commit
c333930b4e
@ -1,5 +1,8 @@
|
||||
extends Action
|
||||
class_name Attack
|
||||
|
||||
func _ready():
|
||||
ActionName = "Attack"
|
||||
|
||||
var timer
|
||||
func execute():
|
||||
@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bbbyup8pp6uam"]
|
||||
|
||||
[ext_resource type="Script" path="res://Test Scenes/Test Player Actions/Scripts/attack.gd" id="1_nmi0m"]
|
||||
[ext_resource type="Script" path="res://Systems/Combat/Actions/Standard Actions/attack.gd" id="1_nmi0m"]
|
||||
|
||||
[node name="attack" type="Node"]
|
||||
script = ExtResource("1_nmi0m")
|
||||
@ -1,25 +1,26 @@
|
||||
extends Control
|
||||
class_name BattleMenu
|
||||
|
||||
var items: Array[MenuItem] = []
|
||||
var top_margin = 100
|
||||
var item_padding = 10
|
||||
var next_y_pos = 0
|
||||
|
||||
func _ready():
|
||||
next_y_pos = top_margin
|
||||
enum ACTION { ATTACK, DEFEND, ITEM }
|
||||
|
||||
func add_action(action: Action):
|
||||
var item = preload("res://Systems/UI/Menu System/menu_item.tscn").instantiate()
|
||||
items.push_back(item)
|
||||
item.label = action.ActionName
|
||||
item.action = action
|
||||
|
||||
item.position.y = next_y_pos
|
||||
next_y_pos += item.get_node("Button").size.y + item_padding
|
||||
|
||||
var panel = $Panel
|
||||
# var button = item.get_node("Button")
|
||||
panel.add_child(item)
|
||||
return item
|
||||
signal action_selected(action)
|
||||
|
||||
|
||||
|
||||
func _on_attack_pressed():
|
||||
action_selected.emit("attack")
|
||||
|
||||
|
||||
func _on_defend_pressed():
|
||||
action_selected.emit("defend")
|
||||
|
||||
|
||||
func _on_item_pressed():
|
||||
pass # GO TO SUBMENU HERE
|
||||
|
||||
|
||||
func _on_tech_pressed():
|
||||
pass # GO TO SUBMENU HERE
|
||||
|
||||
Loading…
Reference in New Issue