Skip to content

Player, pickups, items and shop

Player

Prefab: Prefabs/Core/Player.prefab (tag Player). Health starts at 100 (limit 100, overhealth 200); armor starts at 0 (limit 100, overarmor 200). Armor absorbs damage 1:1 before health. Damage type and difficulty don't change the player's values. There is no resurrection.

Keep the order of the player's AudioSources

The Player root has three AudioSource components, and their order matters: damage and pickups (Effects group), footsteps, and attacks (Weapon group, wired to GridAttackPerformer.audioSource).

Add a HUD portrait

The HUD portrait changes with health; the player picks one in the settings.

  1. Create a PlayerFaceCharacterSO (Create > AiasTech > Player > Face Character) with a positive, unique, stable CharacterId.
  2. Set its name (UI table).
  3. Fill the six stages (Portrait + MinHealthNormalized) in order of their health thresholds.
  4. Add it to Resources/PlayerFaceCatalog.asset.

Pickups

Pickups are collected automatically when the player stops on the cell, all at once if there are several. They use no collider or Rigidbody (don't add one).

Health, armor, ammo and usable items are always collected, even at max (the pickup disappears, adds nothing, and still counts for the items medal). Only a duplicate key, or a duplicate weapon with no ammo to give, stays on the floor; the player must leave the cell and come back to retry.

Warning

A second key of the same color is never collected. Don't place two identical keys in one level.

Ready-made prefabs are in Prefabs/PickUp/ (HealthArmor, AmmoBox, Keys, Weapon, UsableItems), all inheriting from PickUpBase.prefab.

Create a pickup

  1. Create a Prefab Variant of PickUpBase (or duplicate a ready-made variant).
  2. Add the concrete component and set the sprite.
  3. Set the value, text and PickUpSound. Adjust glow and light on GlowAndLightSetup, not on the child Light.
  4. Place it in the level and save the scene. The mapId is generated on save; never fill it on the prefab.

For a usable item on the floor, don't create a prefab: use PickUpUsableItem and pick the Item.

From code: a new pickup type subclasses BasePickUp and needs a case in PickUpManager.TryApplyEffect. When instantiating pickups at runtime, call BasePickUp.SetupAsDrop(go) right after Instantiate; runtime drops are not saved at checkpoints and don't count for the medal.

Loot tables

LootTable (Create > AiasTech > PickUp > Loot Table) is used by enemies, destructibles and chests (examples: ChestDrop, EnemyDrop in Data/PickUp/LootTables). It picks one entry with equal odds (no weights) and spawns minCount–maxCount copies of it. An enemy's drop chance is the prefab's chance × the difficulty's LootDropChance.

Usable items

The item inventory opens with Y. Each item is a UsableItemSO (Create > AiasTech > Equipment > Usable Item); examples are in Data/Equipment. Effects: Heal, Armor, Ammo, TimedBuff, DoubleShot, SelfExplosion.

  • Using an item spends the turn unless ConsumesTurn is off.
  • Healing at full health consumes the item.
  • Buffs from different items stack; the same item refreshes its buff.
  • SelfExplosion can hurt the player if the player's layer is in ExplosionLayers.

Gauntlets

Passive equipment, one equipped at a time. Each is a GauntletSO (Create > AiasTech > Equipment > Gauntlet) that can grant armor regen, armor on hit, vampirism, damage multipliers (1 = neutral), dodge or double damage. Vampirism and armor-on-hit only count damage dealt by the player.

Shop

The shop is opened by an NPC with ShopInteractable (Prefabs/NPC/ShopNpc). Its contents come from Resources/Equipment/EquipmentCatalog.asset.

  • The player pays with points, earned from medals when finishing levels (multiplied by difficulty).
  • UnlockedAtStart only makes an item visible, with no free stock. The first purchase gives StartingStock; later ones give StockPerPurchase.
  • The first unlocked gauntlet in the catalog is the default.
  • Run stock is saved only at a checkpoint or when the level ends.
  • Shopping and equipping don't spend a turn.

Add an item or gauntlet to the shop

  1. Create the asset with a positive, unique, stable ID.
  2. Create a 32×32 icon (Point filter, PPU 32, no compression) in Art/Icon/Gear.
  3. Add the name and description to the localization tables.
  4. Add an entry with a price to EquipmentCatalog.
  5. Run Tools > AiasTech > Scene IDs > Validate Type IDs to catch duplicate IDs.

Never reuse or change published IDs

The save stores items and gauntlets by ID.

To grant points from code: AiasTech.Equipment.EquipmentManager.AddPoints(100);

For internals, see Assets/DungeonCrawler/Scripts/PickUp/ARCHITECTURE.md and Assets/DungeonCrawler/Scripts/Equipment/ARCHITECTURE.md.