Item spawning
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user