Skip to content

Battle/feature - Player Death#1558

Draft
tomipir wants to merge 14 commits into
mainfrom
Battle/feature/PlayerDeath
Draft

Battle/feature - Player Death#1558
tomipir wants to merge 14 commits into
mainfrom
Battle/feature/PlayerDeath

Conversation

@tomipir
Copy link
Copy Markdown
Contributor

@tomipir tomipir commented May 22, 2026

A character will now die if it takes a hit when it has no shield. When a character dies, it plays a death sound and gets removed from battle. If the player does not change to another character in a specified amount of time, it will be done automatically if any character is still alive.

Also added a visual indicator for a dead character and reordered logic in BattlePlayerQSystem's Update method

Issues:

  • Player cannot give up if all of his characters are dead

BattleUiPlayerInfo.Prefab

  • Added DeathImage gameobjects to show on top of dead characters

QuantumBattle.unity

  • Added DeathImage gameobjects to BattleUiCharacterButtonComponent scripts in BattleUi

BattleEvents.qtn

  • Added synced event BattleCharacterDeath
    • Added BattlePlayerSlot Slot field
    • Added int CharacterNumber field

BattlePlayerQSystem.cs

  • OnProjectileHitPlayerCharacter
    • If CurrentDefence <= 0, skips the normal hit logic and instead
      • Calls BattleCharacterDeath event
      • Calls BattlePlayerManager.DespawnPlayer method with kill : true argument
      • Starts PlayerHandle.RespawnTimer frame timer
      • calls PlayerHandle.SetOutOfPlayRespawning method

BattleGameViewController

  • Added QEventOnBattleCharacterDeath method
    • Calls _uiController.PlayerInfoHandler.UpdateDefenceVisual method
    • Calls _uiController.PlayerInfoHandler.SetDeathImage method
  • QEventOnShieldHit
    • Removed check for ShieldAttached

BattleUiCharacterButtonComponent.cs

  • Added SerializeField private GameObject _deathImage
  • Added public void SetDeathImage method
    • Sets _deathImage to active

BattleUiPlayerInfoHandler.cs

  • Added public void SetDeathImage method
    • Calls SetDeathImage for the correct BattleUiCharacterButtonComponent

closes #1550

@tomipir tomipir added Quantum Battle battleen liittyvät tehtävät labels May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Battle battleen liittyvät tehtävät Quantum

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task: Pelaajan kuolema

1 participant