-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Phazorknight:main' into main
- Loading branch information
Showing
10 changed files
with
188 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
extends Node3D | ||
class_name CogitoWieldable | ||
|
||
@export_group("General Wieldable Settings") | ||
## Item resource that this wieldable refers to. | ||
@export var item_reference : WieldableItemPD | ||
## Visible parts of the wieldable. Used to hide/show on equip/unequip. | ||
@export var wieldable_mesh : Node3D | ||
|
||
@export_group("Animations") | ||
@onready var animation_player: AnimationPlayer = $AnimationPlayer | ||
@onready var audio_stream_player_3d = $AudioStreamPlayer3D | ||
|
||
@export var anim_equip: String = "equip" | ||
@export var anim_unequip: String = "unequip" | ||
@export var anim_action_primary: String = "action_primary" | ||
@export var anim_action_secondary: String = "action_secondary" | ||
@export var anim_reload: String = "reload" | ||
|
||
var player_interaction_component : PlayerInteractionComponent | ||
|
||
### Every wieldable needs the following functions: | ||
### equip(_player_interaction_component), unequip(), action_primary(), action_secondary(), reload() | ||
|
||
func _ready(): | ||
if wieldable_mesh: | ||
wieldable_mesh.hide() | ||
|
||
|
||
# Function called when wieldable is unequipped. | ||
func equip(_player_interaction_component: PlayerInteractionComponent): | ||
animation_player.play(anim_equip) | ||
player_interaction_component = _player_interaction_component | ||
|
||
|
||
# Function called when wieldable is unequipped. | ||
func unequip(): | ||
animation_player.play(anim_unequip) | ||
|
||
|
||
# Primary action called by the Player Interaction Component when flashlight is wielded. | ||
func action_primary(_passed_item_reference:InventoryItemPD, _is_released: bool): | ||
pass | ||
|
||
|
||
# Secondary action called by the Player Interaction Component when flashlight is wielded. | ||
func action_secondary(_is_released: bool): | ||
pass | ||
|
||
|
||
# Function called when wieldable reload is attempted | ||
func reload(): | ||
pass |
Oops, something went wrong.