private void Actor_Spawn(object sender, EventArgs e) { Actor spawnedActor = (Actor)sender; actors.Add(spawnedActor); if (spawnedActor.className == "player") { protagonist = spawnedActor; } if (!healthBars.ContainsKey(spawnedActor) && spawnedActor.health < spawnedActor.maxHealth) { if (spawnedActor.className == "player") healthBars[spawnedActor] = new HealthBar(spawnedActor, guiTextures["healthBar"]); else healthBars[spawnedActor] = new HealthBar(spawnedActor, guiTextures["enemyHealthBar"]); } }
private void Actor_Hurt(object sender, AttackEventArgs e) { Actor hurtActor = (Actor)sender; if (!healthBars.ContainsKey(hurtActor)) { if (hurtActor.className == "player") healthBars[hurtActor] = new HealthBar(hurtActor, guiTextures["healthBar"]); else healthBars[hurtActor] = new HealthBar(hurtActor, guiTextures["enemyHealthBar"]); } }