public void EjectCharacters() { LogicArrayList <LogicComponent> components = this.GetComponentManager().GetComponents(LogicComponentType.MOVEMENT); int ejectHousingSpace = this.GetTrapData().GetEjectHousingLimit(this.m_upgLevel); int radius = this.GetTrapData().GetTriggerRadius(); for (int i = 0; i < components.Size(); i++) { LogicMovementComponent movementComponent = (LogicMovementComponent)components[i]; LogicGameObject parent = movementComponent.GetParent(); if (parent.GetGameObjectType() == LogicGameObjectType.CHARACTER) { LogicCharacter character = (LogicCharacter)parent; if (character.GetHitpointComponent() != null && character.GetHitpointComponent().GetTeam() == 0 && character.GetCharacterData().GetHousingSpace() <= ejectHousingSpace) { int distanceX = character.GetX() - this.GetMidX(); int distanceY = character.GetY() - this.GetMidY(); if (LogicMath.Abs(distanceX) <= radius && LogicMath.Abs(distanceY) <= radius) { if (character.GetCombatComponent() == null || character.GetCombatComponent().GetUndergroundTime() <= 0) { int distanceSquared = distanceX * distanceX + distanceY * distanceY; if (distanceSquared < (uint)(radius * radius)) { character.Eject(null); ejectHousingSpace -= character.GetCharacterData().GetHousingSpace(); } } } } } } }