conforms file names to consistant standard
This commit is contained in:
52
characters/fsm/building_state.gd
Normal file
52
characters/fsm/building_state.gd
Normal file
@@ -0,0 +1,52 @@
|
||||
class_name BuildingState
|
||||
extends HeroState
|
||||
|
||||
@export var swap_state: HeroState
|
||||
|
||||
|
||||
func enter_state() -> void:
|
||||
if hero.game_manager:
|
||||
hero.game_manager.level.enable_non_path_tower_frames()
|
||||
hero.edit_tool.enabled = true
|
||||
hero.left_hand_model.visible = true
|
||||
hero.gauntlet_model.visible = true
|
||||
hero.cassette.visible = false
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.set_parallel()
|
||||
tween.tween_method(anim, hero.anim_tree.get("parameters/Blend3/blend_amount"), -1.0, 0.5)
|
||||
tween.tween_method(anim2, hero.anim_tree2.get("parameters/Blend2/blend_amount"), 1.0, 0.5)
|
||||
|
||||
|
||||
func anim(x: float) -> void:
|
||||
hero.anim_tree.set("parameters/Blend3/blend_amount", x)
|
||||
|
||||
|
||||
func anim2(x: float) -> void:
|
||||
hero.anim_tree2.set("parameters/Blend2/blend_amount", x)
|
||||
|
||||
|
||||
func exit_state() -> void:
|
||||
hero.edit_tool.interact_key_held = false
|
||||
hero.edit_tool.enabled = false
|
||||
hero.cassette.visible = true
|
||||
if hero.game_manager:
|
||||
hero.game_manager.level.disable_all_tower_frames()
|
||||
|
||||
|
||||
func process_state(_delta: float) -> void:
|
||||
hero.check_world_button()
|
||||
if Input.is_action_just_pressed("Primary Fire"):
|
||||
hero.edit_tool.interact_key_held = true
|
||||
if Input.is_action_just_released("Primary Fire"):
|
||||
hero.edit_tool.interact_key_held = false
|
||||
if Input.is_action_just_pressed("Swap Weapons"):
|
||||
state_changed.emit(swap_state)
|
||||
if Input.is_action_just_pressed("Ready"):
|
||||
if hero.ready_state:
|
||||
hero.unready_self()
|
||||
else:
|
||||
hero.ready_self()
|
||||
if !hero.game_manager and Input.is_action_just_pressed("Ready"):
|
||||
hero.enter_fighting_state()
|
||||
1
characters/fsm/building_state.gd.uid
Normal file
1
characters/fsm/building_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b5h7jfwkyokes
|
||||
85
characters/fsm/carding_state.gd
Normal file
85
characters/fsm/carding_state.gd
Normal file
@@ -0,0 +1,85 @@
|
||||
class_name cassetteingState
|
||||
extends HeroState
|
||||
|
||||
@export var swap_state: HeroState
|
||||
|
||||
|
||||
func enter_state() -> void:
|
||||
if hero.game_manager:
|
||||
hero.game_manager.level.disable_all_tower_frames()
|
||||
hero.left_hand_model.visible = true
|
||||
hero.gauntlet_model.visible = true
|
||||
hero.set_cassette_elements_visibility(true)
|
||||
hero.cassetteing_tool.enabled = true
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.set_parallel()
|
||||
tween.tween_method(anim, hero.anim_tree.get("parameters/Blend3/blend_amount"), 0.0, 0.5)
|
||||
tween.tween_method(anim2, hero.anim_tree2.get("parameters/Blend2/blend_amount"), 0.0, 0.5)
|
||||
|
||||
|
||||
func anim(x: float) -> void:
|
||||
hero.anim_tree.set("parameters/Blend3/blend_amount", x)
|
||||
|
||||
|
||||
func anim2(x: float) -> void:
|
||||
hero.anim_tree2.set("parameters/Blend2/blend_amount", x)
|
||||
|
||||
|
||||
func exit_state() -> void:
|
||||
hero.set_cassette_elements_visibility(false)
|
||||
hero.left_hand.visible = false
|
||||
hero.cassetteing_tool.enabled = false
|
||||
|
||||
|
||||
func process_state(_delta: float) -> void:
|
||||
hero.check_world_button()
|
||||
if Input.is_action_just_pressed("Interact"):
|
||||
hero.cassetteing_tool.interact()
|
||||
if Input.is_action_just_pressed("Primary Fire"):
|
||||
hero.equip_weapon(0)
|
||||
if Input.is_action_just_pressed("Secondary Fire"):
|
||||
hero.equip_weapon(1)
|
||||
if Input.is_action_just_pressed("Select Next Cassette") and hero.hand.size > 1:
|
||||
hero.increment_selected()
|
||||
hero.swap_cassette_audio.play()
|
||||
if Input.is_action_just_pressed("Select Previous Cassette") and hero.hand.size > 1:
|
||||
hero.decrement_selected()
|
||||
hero.swap_cassette_audio.play()
|
||||
if Input.is_action_just_pressed("Equip 1"):
|
||||
swap_to_slot(1)
|
||||
if Input.is_action_just_pressed("Equip 2"):
|
||||
swap_to_slot(2)
|
||||
if Input.is_action_just_pressed("Equip 3"):
|
||||
swap_to_slot(3)
|
||||
if Input.is_action_just_pressed("Equip 4"):
|
||||
swap_to_slot(4)
|
||||
if Input.is_action_just_pressed("Equip 5"):
|
||||
swap_to_slot(5)
|
||||
if Input.is_action_just_pressed("Equip 6"):
|
||||
swap_to_slot(6)
|
||||
if Input.is_action_just_pressed("Equip 7"):
|
||||
swap_to_slot(7)
|
||||
if Input.is_action_just_pressed("Equip 8"):
|
||||
swap_to_slot(8)
|
||||
if Input.is_action_just_pressed("Equip 9"):
|
||||
swap_to_slot(9)
|
||||
if Input.is_action_just_pressed("Equip 10"):
|
||||
swap_to_slot(10)
|
||||
if Input.is_action_just_pressed("Swap Weapons"):
|
||||
state_changed.emit(swap_state)
|
||||
if Input.is_action_just_pressed("Ready"):
|
||||
if hero.ready_state:
|
||||
hero.unready_self()
|
||||
else:
|
||||
hero.ready_self()
|
||||
if !hero.game_manager and Input.is_action_just_pressed("Ready"):
|
||||
hero.enter_fighting_state()
|
||||
|
||||
|
||||
func swap_to_slot(num: int) -> void:
|
||||
if hero.hand.size >= num:
|
||||
hero.hand_selected_index = num - 1
|
||||
hero.swap_cassette_audio.play()
|
||||
hero.hud.hot_wheel.update_cassettes(hero.get_wheel_cassettes())
|
||||
1
characters/fsm/carding_state.gd.uid
Normal file
1
characters/fsm/carding_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cjdv1onyfej0m
|
||||
79
characters/fsm/fighting_state.gd
Normal file
79
characters/fsm/fighting_state.gd
Normal file
@@ -0,0 +1,79 @@
|
||||
class_name FightingState
|
||||
extends HeroState
|
||||
|
||||
|
||||
func enter_state() -> void:
|
||||
hero.hud.unset_hover_text()
|
||||
hero.hud.set_currencies_visible(false)
|
||||
hero.left_hand_model.visible = false
|
||||
if hero.weapons[hero.equipped_weapon]:
|
||||
hero.hud.set_energy_visible(true)
|
||||
var offhand_weapon: Weapon = hero.weapons[0] if hero.equipped_weapon == 1 else hero.weapons[1]
|
||||
if offhand_weapon:
|
||||
offhand_weapon.current_energy = offhand_weapon.max_energy
|
||||
if (!hero.weapons[hero.equipped_weapon] and offhand_weapon) or (hero.weapons[0] and hero.equipped_weapon == 1):
|
||||
hero.swap_weapons()
|
||||
if hero.weapons[hero.equipped_weapon]:
|
||||
hero.weapons[hero.equipped_weapon].current_energy = hero.weapons[hero.equipped_weapon].max_energy
|
||||
#this had to be commented out coz the new energy bar thinks "energy changed" is "energy used"
|
||||
#weapons[equipped_weapon].energy_changed.emit(weapons[equipped_weapon].current_energy)
|
||||
if hero.game_manager and hero.game_manager.cassette_gameplay:
|
||||
for x: int in hero.hand.contents.size():
|
||||
hero.discassette_pile.add(hero.hand.remove_at(hero.hand.contents.size() - 1))
|
||||
hero.weapon_swap_timer.start()
|
||||
hero.hud.energy_label.visible = false
|
||||
if !hero.weapons[hero.equipped_weapon] and !offhand_weapon:
|
||||
hero.gauntlet_model.visible = false
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_CUBIC)
|
||||
tween.tween_method(anim, hero.anim_tree.get("parameters/Blend3/blend_amount"), 1.0, 0.5)
|
||||
|
||||
|
||||
func anim(x: float) -> void:
|
||||
hero.anim_tree.set("parameters/Blend3/blend_amount", x)
|
||||
|
||||
|
||||
func exit_state() -> void:
|
||||
hero.hud.set_currencies_visible(true)
|
||||
if hero.weapons[hero.equipped_weapon]:
|
||||
hero.weapons[hero.equipped_weapon].release_trigger()
|
||||
hero.weapons[hero.equipped_weapon].release_second_trigger()
|
||||
hero.weapons[hero.equipped_weapon].visible = false
|
||||
hero.hud.set_energy_visible(false)
|
||||
hero.hud.grow_wave_start_label()
|
||||
#hero.hud.primary_duration.visible = true
|
||||
#hero.hud.secondary_duration.visible = true
|
||||
if hero.game_manager and hero.game_manager.cassette_gameplay:
|
||||
hero.hud.energy_label.visible = true
|
||||
|
||||
|
||||
func play_shoot_animation() -> void:
|
||||
hero.anim_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
|
||||
|
||||
|
||||
func process_state(_delta: float) -> void:
|
||||
if hero.weapons[hero.equipped_weapon] and hero.weapons_active:
|
||||
if Input.is_action_just_pressed("Primary Fire"):
|
||||
hero.weapons[hero.equipped_weapon].hold_trigger()
|
||||
if Input.is_action_just_released("Primary Fire"):
|
||||
hero.weapons[hero.equipped_weapon].release_trigger()
|
||||
if Input.is_action_pressed("Secondary Fire"):
|
||||
hero.weapons[hero.equipped_weapon].hold_second_trigger()
|
||||
if Input.is_action_just_released("Secondary Fire"):
|
||||
hero.weapons[hero.equipped_weapon].release_second_trigger()
|
||||
if Input.is_action_pressed("Primary Fire"):
|
||||
hero.movement.can_sprint = false
|
||||
if Input.is_action_pressed("Secondary Fire"):
|
||||
hero.movement.can_sprint = false
|
||||
if Input.is_action_just_pressed("Equip Primary Weapon"):
|
||||
if hero.equipped_weapon == 1 and hero.weapons[0]:
|
||||
hero.swap_weapons()
|
||||
if Input.is_action_just_pressed("Equip Secondary Weapon"):
|
||||
if hero.equipped_weapon == 0 and hero.weapons[1]:
|
||||
hero.swap_weapons()
|
||||
if Input.is_action_just_pressed("Swap Weapons"):
|
||||
if hero.weapons[0] and hero.weapons[1]:
|
||||
hero.swap_weapons()
|
||||
if !hero.game_manager and Input.is_action_just_pressed("Ready"):
|
||||
hero.exit_fighting_state()
|
||||
1
characters/fsm/fighting_state.gd.uid
Normal file
1
characters/fsm/fighting_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cf7m4yyiqhhru
|
||||
20
characters/fsm/hero_state.gd
Normal file
20
characters/fsm/hero_state.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
class_name HeroState
|
||||
extends Node
|
||||
|
||||
@warning_ignore("unused_signal")
|
||||
signal state_changed(new_state: HeroState)
|
||||
|
||||
@export var hero: Hero
|
||||
|
||||
|
||||
func enter_state() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func exit_state() -> void:
|
||||
pass
|
||||
|
||||
|
||||
@warning_ignore("unused_parameter")
|
||||
func process_state(delta: float) -> void:
|
||||
pass
|
||||
1
characters/fsm/hero_state.gd.uid
Normal file
1
characters/fsm/hero_state.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cl8ovljfiagxv
|
||||
Reference in New Issue
Block a user