public void hitBy(Enemy e, float damage) { if (RetroGame.INVINCIBILITY) { return; } health -= damage; if (health <= 0) { if (attemptDie()) { playerPrisoner = new PlayerPrisoner(this, levelX, levelY, tileX, tileY); RetroGame.EscapeScreen.levelManager.levels[levelX, levelY].prisoners.Add(playerPrisoner); return; } } SoundManager.PlaySoundOnce("PlayerHit", playInReverseDuringReverse: true); flashWithColor(Color.Red.withAlpha(150), 2, 0.5f); }
public void revive(Vector2?atPosition = null) { Alive = true; health = REVIVE_HEALTH; LevelManager levelManager = RetroGame.EscapeScreen.levelManager; levelManager.SetCameraMode(RetroGame.EscapeScreen.levelManager.CameraMode); if (playerPrisoner != null) { levelManager.collectablesToRemove.Add(playerPrisoner); playerPrisoner = null; } if (atPosition != null) { position = atPosition.Value; } updateCurrentLevelAndTile(); flashWithColor(Color.Cyan.withAlpha(150), 2, 0.75f); }