Item spawning

This commit is contained in:
2024-09-08 14:19:30 -07:00
parent 29a6d1072c
commit a47d1306b9
417 changed files with 17412 additions and 1019 deletions

View File

@@ -2,7 +2,6 @@ using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using GameJamDungeon;
using Godot;
using System;
using System.Linq;
[Meta(typeof(IAutoNode))]
@@ -10,34 +9,24 @@ public partial class Accessory : InventoryItem
{
public override void _Notification(int what) => this.Notify(what);
[Dependency] IGameRepo GameRepo => this.DependOn<IGameRepo>();
public AccessoryInfo AccessoryInfo { get => (AccessoryInfo)Info; }
public new InventoryItemInfo Info => AccessoryInfo;
[Export]
internal override InventoryItemInfo Info { get; set; }
public AccessoryInfo AccessoryInfo { get; set; }
public void OnReady()
{
Sprite.Texture = AccessoryInfo.Texture;
Pickup.BodyEntered += OnEntered;
}
public void OnEntered(Node body)
public void OnEntered(Node3D body)
{
if (GameRepo.InventoryItems.Value.Count() >= GameRepo.MaxItemSize)
{
AnimationPlayer.Play("drop");
return;
}
var inventoryList = GameRepo.InventoryItems.Value.Append(this).ToList();
GameRepo.InventoryItems.OnNext(inventoryList);
QueueFree();
}
}
public enum AccessoryTag
{
HalfVTConsumption,
StatusEffectImmunity
}