Mystery item implementation
This commit is contained in:
@@ -24,7 +24,7 @@ public partial class InGameAudioLogic
|
||||
gameRepo.UnequippedItem += OnUnequippedItem;
|
||||
gameEventDepot.InventorySorted += OnInventorySorted;
|
||||
gameEventDepot.HealingItemConsumed += OnHealingItemConsumed;
|
||||
gameEventDepot.RestorativePickedUp += OnRestorativePickedUp;
|
||||
gameRepo.RestorativePickedUp += OnRestorativePickedUp;
|
||||
gameEventDepot.TeleportEntered += OnTeleportEntered;
|
||||
gameRepo.PlayerAttack += OnPlayerAttack;
|
||||
gameRepo.PlayerAttackedWall += OnPlayerAttackWall;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Chickensoft.Collections;
|
||||
using Godot;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
|
||||
namespace Zennysoft.Ma.Adapter;
|
||||
|
||||
@@ -29,6 +30,8 @@ public interface IGameRepo : IDisposable
|
||||
|
||||
event Action<EquipableItem>? UnequippedItem;
|
||||
|
||||
event Action<IHealthPack>? RestorativePickedUp;
|
||||
|
||||
void Pause();
|
||||
|
||||
void Resume();
|
||||
@@ -51,6 +54,8 @@ public interface IGameRepo : IDisposable
|
||||
|
||||
public void OnPlayerAttackedEnemy();
|
||||
|
||||
public void OnRestorativePickedUp(IHealthPack restorative);
|
||||
|
||||
public void CloseInventory();
|
||||
|
||||
public void GameEnded();
|
||||
@@ -76,7 +81,7 @@ public class GameRepo : IGameRepo
|
||||
public event Action? PlayerAttackedEnemy;
|
||||
public event Action<EquipableItem>? EquippedItem;
|
||||
public event Action<EquipableItem>? UnequippedItem;
|
||||
|
||||
public event Action<IHealthPack>? RestorativePickedUp;
|
||||
public IAutoProp<bool> IsPaused => _isPaused;
|
||||
private readonly AutoProp<bool> _isPaused;
|
||||
|
||||
@@ -146,6 +151,11 @@ public class GameRepo : IGameRepo
|
||||
PlayerAttackedEnemy?.Invoke();
|
||||
}
|
||||
|
||||
public void OnRestorativePickedUp(IHealthPack restorative)
|
||||
{
|
||||
RestorativePickedUp?.Invoke(restorative);
|
||||
}
|
||||
|
||||
public void CloseInventory()
|
||||
{
|
||||
CloseInventoryEvent?.Invoke();
|
||||
|
||||
@@ -30,7 +30,4 @@ public interface IGameEventDepot : IDisposable
|
||||
|
||||
event Action<InventoryItem>? HealingItemConsumed;
|
||||
public void OnHealingItemConsumed(InventoryItem item);
|
||||
|
||||
event Action<IHealthPack>? RestorativePickedUp;
|
||||
public void OnRestorativePickedUp(IHealthPack restorative);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace Zennysoft.Ma.Adapter;
|
||||
[Meta, Id("equipable_item")]
|
||||
public abstract partial class EquipableItem : InventoryItem
|
||||
{
|
||||
public abstract ItemTag ItemTag { get; }
|
||||
|
||||
[Save("equipable_item_is_equipped")]
|
||||
public bool IsEquipped { get; set; }
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ public interface IInventory
|
||||
|
||||
public bool TryAdd(InventoryItem inventoryItem);
|
||||
|
||||
public bool TryInsert(InventoryItem inventoryItem, int index);
|
||||
|
||||
public void Remove(InventoryItem inventoryItem);
|
||||
|
||||
public void Sort();
|
||||
|
||||
@@ -19,6 +19,8 @@ public abstract partial class InventoryItem : Node3D
|
||||
public abstract double ThrowDamage { get; }
|
||||
[Save("inventory_item_throw_speed")]
|
||||
public abstract float ThrowSpeed { get; }
|
||||
[Save("inventory_item_tag")]
|
||||
public abstract ItemTag ItemTag { get; }
|
||||
|
||||
public abstract Texture2D GetTexture();
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
public enum ItemTag
|
||||
{
|
||||
None,
|
||||
BreaksOnChange
|
||||
BreaksOnChange,
|
||||
MysteryItem
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ public interface IPlayer : IKillable
|
||||
|
||||
public Basis CurrentBasis { get; }
|
||||
|
||||
public IAutoProp<EquipableItem> EquippedWeapon { get; }
|
||||
public AutoProp<EquipableItem> EquippedWeapon { get; }
|
||||
|
||||
public IAutoProp<EquipableItem> EquippedArmor { get; }
|
||||
public AutoProp<EquipableItem> EquippedArmor { get; }
|
||||
|
||||
public IAutoProp<EquipableItem> EquippedAccessory { get; }
|
||||
public AutoProp<EquipableItem> EquippedAccessory { get; }
|
||||
|
||||
public void Equip(EquipableItem equipable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user