public void KillEntity(Entity entity) { if (HasDeathAnimation(entity)) { EntityType type = entity.Type; //TODO temporary if (type == EntityType.ForestArcher || type == EntityType.ForestKnight || type == EntityType.ForestWolf || type == EntityType.ForestBoss) { Assets.GetSound("Sterben").Play(); } ExecuteDeathAnimation(entity); DeactivateSelectComponents(entity); } else { EntityType type = entity.Type; //TODO temporary if (type == EntityType.ForestArcher || type == EntityType.ForestKnight || type == EntityType.ForestWolf || type == EntityType.ForestBoss) { _levelTracker.EnemiesCount--; if (_levelTracker.EnemiesCount <= 0) { _levelTracker.ReadyForRestart = true; } } DeactivateAllComponents(entity); } entity.Alive = false; }
public override Screen LoadContent() { LoadLevel(); SoundEffect soundTrack = Assets.GetSound("ThemeSong"); var instance = soundTrack.CreateInstance(); instance.IsLooped = true; instance.Play(); return(this); }
private void ProjectileOnHealth(ProjectileComponent actor, HealthComponent target) { if (target.Invincible) { return; } if (actor.Power >= actor.Damage) //actor can afford full strike { if (target.ProcessedHealth >= actor.Damage) //target can afford full strike { target.ProcessedHealth -= actor.Damage; actor.Power -= actor.Damage; } else //target takes partial strike { actor.Power -= target.ProcessedHealth; target.ProcessedHealth = 0; } } else //actor can only afford partial strike { if (target.ProcessedHealth >= actor.Power) //target can afford full strike { target.ProcessedHealth -= actor.Power; actor.Power = 0; } else //target takes partial strike { actor.Power -= target.ProcessedHealth; target.ProcessedHealth = 0; } } if (actor.Power <= 0) { actor.CurrentEntityState.Dead = true; } if (target.ProcessedHealth <= 0) { target.CurrentEntityState.Dead = true; } else { if (!actor.IsPhasing) { actor.CurrentEntityState.Dead = true; //projectile didnt penetrate } ApplyKnockback(actor, target); } SoundEffect effect = Assets.GetSound("Schlag"); effect.Play(); }