mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 02:15:54 +00:00
Ability to switch weapons through the menu
This commit is contained in:
parent
12b8d4a70f
commit
ff6d46ebcd
11 changed files with 61 additions and 4 deletions
|
|
@ -206,6 +206,16 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
EquippedWeapons.Add(weapon);
|
||||
}
|
||||
|
||||
public void EquipWeapon(string itemKey)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(itemKey)) return;
|
||||
var weapon = EquippedWeapons.FirstOrDefault(x => x.WeaponData.ItemKey == itemKey);
|
||||
|
||||
if (weapon is null) return;
|
||||
|
||||
EquipWeapon(weapon);
|
||||
}
|
||||
|
||||
public void EquipWeapon(Weapon weapon)
|
||||
{
|
||||
EquippedWeapon = weapon;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue