33 lines
753 B
C#
33 lines
753 B
C#
using Chickensoft.AutoInject;
|
|
using Chickensoft.Introspection;
|
|
using GameJamDungeon;
|
|
using Godot;
|
|
using System.Linq;
|
|
|
|
[Meta(typeof(IAutoNode))]
|
|
public partial class Armor : InventoryItem
|
|
{
|
|
public override void _Notification(int what) => this.Notify(what);
|
|
|
|
public new InventoryItemInfo Info => ArmorInfo;
|
|
|
|
[Export]
|
|
public ArmorInfo ArmorInfo { get; set; }
|
|
|
|
public void OnReady()
|
|
{
|
|
Sprite.Texture = ArmorInfo.Texture;
|
|
Pickup.BodyEntered += OnEntered;
|
|
}
|
|
|
|
public void OnEntered(Node3D body)
|
|
{
|
|
if (GameRepo.InventoryItems.Value.Count() >= GameRepo.MaxItemSize)
|
|
return;
|
|
|
|
var inventoryList = GameRepo.InventoryItems.Value.Append(this).ToList();
|
|
GameRepo.InventoryItems.OnNext(inventoryList);
|
|
QueueFree();
|
|
}
|
|
}
|