public ShieldGeneratorComponent GetActiveShieldAffectingBoardPos(int targetBoardX, int targetBoardZ) { ShieldGeneratorComponent result = null; float num = 3.40282347E+38f; NodeList <ShieldGeneratorNode> shieldGeneratorNodeList = Service.BuildingLookupController.ShieldGeneratorNodeList; for (ShieldGeneratorNode shieldGeneratorNode = shieldGeneratorNodeList.Head; shieldGeneratorNode != null; shieldGeneratorNode = shieldGeneratorNode.Next) { Entity entity = shieldGeneratorNode.Entity; if (entity != null && entity.Has <HealthComponent>() && !entity.Get <HealthComponent>().IsDead()) { ShieldGeneratorComponent shieldGenComp = shieldGeneratorNode.ShieldGenComp; if (shieldGenComp != null) { Entity shieldBorderEntity = shieldGenComp.ShieldBorderEntity; if (shieldBorderEntity != null && shieldBorderEntity.Has <HealthComponent>() && !shieldBorderEntity.Get <HealthComponent>().IsDead()) { float num2; if (this.IsPositionUnderShield(targetBoardX, targetBoardZ, (SmartEntity)entity, out num2) && num2 < num) { num = num2; result = shieldGenComp; } } } } } return(result); }
public void CheckHealthView(SmartEntity entity) { HealthComponent healthComp = entity.HealthComp; ShieldBorderComponent shieldBorderComp = entity.ShieldBorderComp; if (shieldBorderComp != null) { SmartEntity smartEntity = (SmartEntity)shieldBorderComp.ShieldGeneratorEntity; GameObjectViewComponent gameObjectViewComp = smartEntity.GameObjectViewComp; bool showAtFullHealth = this.ShowHealthView(entity, healthComp, gameObjectViewComp, false, true, false, false); this.ShowHealthView(smartEntity, smartEntity.HealthComp, gameObjectViewComp, true, false, showAtFullHealth, true); return; } ShieldGeneratorComponent shieldGeneratorComp = entity.ShieldGeneratorComp; if (shieldGeneratorComp != null) { SmartEntity smartEntity2 = (SmartEntity)shieldGeneratorComp.ShieldBorderEntity; GameObjectViewComponent gameObjectViewComp = entity.GameObjectViewComp; bool showAtFullHealth2 = this.ShowHealthView(entity, healthComp, gameObjectViewComp, true, false, false, true); this.ShowHealthView(smartEntity2, smartEntity2.HealthComp, gameObjectViewComp, false, true, showAtFullHealth2, false); return; } TroopShieldHealthComponent troopShieldHealthComp = entity.TroopShieldHealthComp; bool hasSecondary = false; bool showAtFullHealth3 = false; if (troopShieldHealthComp != null) { showAtFullHealth3 = this.ShowHealthView(entity, troopShieldHealthComp, entity.GameObjectViewComp, true, true, true, false); hasSecondary = true; } this.ShowHealthView(entity, healthComp, entity.GameObjectViewComp, true, hasSecondary, showAtFullHealth3, true); }
public FlagStamp CreateFlagStampForShield(ShieldGeneratorComponent sgc, SizeComponent size, int walkableGap) { int num = 1; int num2 = 1; int num3 = (num2 + num + sgc.CurrentRadius) * 2 - 1; FlagStamp flagStamp = new FlagStamp(num3, num3, 0u, true); flagStamp.SetFlagsInRectCenter(size.Width - walkableGap + 2, size.Depth - walkableGap + 2, 4u); flagStamp.FillCircle(sgc.CurrentRadius + num, 16u, true); flagStamp.StrokeHull(8u, 16u); flagStamp.FillCircle(sgc.CurrentRadius + num2, 16u, true); return(flagStamp); }
public bool GetRayShieldIntersection(Vector3 rayPos, Vector3 targetPos, ShieldGeneratorComponent shield, out Vector3 intersectionWorldPoint) { SmartEntity smartEntity = shield.Entity as SmartEntity; if (smartEntity == null) { intersectionWorldPoint = Vector3.zero; return(false); } TransformComponent transformComp = smartEntity.TransformComp; Vector3 ellipseOrigin = new Vector3(Units.BoardToWorldX(transformComp.CenterX()), 1.25f, Units.BoardToWorldZ(transformComp.CenterZ())); float num = 3f * (float)shield.CurrentRadius; Vector3 ellipseRadius = new Vector3(num, num, num); Vector3 rayDir = targetPos - rayPos; targetPos.Normalize(); return(UnityUtils.GetRayEllipsoidIntersection(rayPos, rayDir, ellipseOrigin, ellipseRadius, out intersectionWorldPoint)); }
public void AddShieldComponentsToEntity(Entity buildingEntity, BuildingTypeVO buildingType) { Entity entity = this.NewEntity(); HealthComponent component = new HealthComponent(Service.Get <ShieldController>().PointsToHealth[buildingType.ShieldHealthPoints], ArmorType.Shield); entity.Add(component); entity.Add(new ShieldBorderComponent { ShieldGeneratorEntity = buildingEntity }); TeamComponent component2 = new TeamComponent(buildingEntity.Get <TeamComponent>().TeamType); entity.Add(component2); Service.Get <EntityController>().AddEntity(entity); ShieldGeneratorComponent shieldGeneratorComponent = new ShieldGeneratorComponent(); shieldGeneratorComponent.PointsRange = buildingType.ShieldRangePoints; shieldGeneratorComponent.CurrentRadius = Service.Get <ShieldController>().PointsToRange[shieldGeneratorComponent.PointsRange]; shieldGeneratorComponent.ShieldBorderEntity = entity; buildingEntity.Add(shieldGeneratorComponent); }
public FlagStamp CreateFlagStamp(Entity building, BuildingTypeVO buildingVO, SizeComponent size, int walkableGap) { ShieldGeneratorComponent shieldGeneratorComponent = null; BuildingComponent buildingComponent = null; if (building != null) { shieldGeneratorComponent = building.Get <ShieldGeneratorComponent>(); buildingComponent = building.Get <BuildingComponent>(); } if (shieldGeneratorComponent != null) { return(Service.Get <ShieldController>().CreateFlagStampForShield(shieldGeneratorComponent, size, walkableGap)); } uint num; if (buildingVO != null && buildingVO.Type == BuildingType.Trap) { num = 0u; } else { num = 4u; } if (buildingVO != null && buildingVO.AllowDefensiveSpawn) { num |= 32u; } if (buildingComponent != null && buildingComponent.BuildingType.SpawnProtection > 0) { int num2 = buildingComponent.BuildingType.SpawnProtection; int num3 = num2 - (size.Width - walkableGap); if (num3 % 2 == 1) { num2++; } return(new FlagStamp(num2, num2, num, false)); } return(new FlagStamp(size.Width - walkableGap + 2, size.Depth - walkableGap + 2, num, false)); }
private void ImpactAreaWithSplash(Bullet bullet) { int targetBoardX = bullet.TargetBoardX; int targetBoardZ = bullet.TargetBoardZ; int splashRadius = bullet.SplashVO.SplashRadius; BoardCellDynamicArray cellsInSquare = Service.BoardController.Board.GetCellsInSquare(splashRadius, targetBoardX, targetBoardZ); Dictionary <Entity, bool> dictionary = new Dictionary <Entity, bool>(); Vector3 targetWorldLocation = bullet.TargetWorldLocation; for (int i = 0; i < cellsInSquare.Length; i++) { BoardCell boardCell = cellsInSquare.Array[i]; int chessboardDistance = BoardUtils.GetChessboardDistance(boardCell.X, boardCell.Z, targetBoardX, targetBoardZ); int splashDamagePercent = bullet.SplashVO.GetSplashDamagePercent(chessboardDistance); if (splashDamagePercent != 0) { ShieldGeneratorComponent activeShieldAffectingBoardPos = Service.ShieldController.GetActiveShieldAffectingBoardPos(boardCell.X, boardCell.Z); if (activeShieldAffectingBoardPos != null && !bullet.ProjectileType.PassThroughShield && activeShieldAffectingBoardPos.Entity.Get <TeamComponent>().TeamType != bullet.OwnerTeam) { TransformComponent transformComponent = activeShieldAffectingBoardPos.Entity.Get <TransformComponent>(); Vector3 targetPos = new Vector3(Units.BoardToWorldX(transformComponent.CenterX()), transformComponent.CenterX(), Units.BoardToWorldZ(transformComponent.CenterZ())); Vector3 zero = Vector3.zero; if (Service.ShieldController.GetRayShieldIntersection(targetWorldLocation, targetPos, activeShieldAffectingBoardPos, out zero)) { bullet.SetTargetWorldLocation(zero); } this.ImpactTargetFromSplashDamage((SmartEntity)activeShieldAffectingBoardPos.ShieldBorderEntity, bullet, splashDamagePercent, ref dictionary); } else if (boardCell.Children != null) { LinkedListNode <BoardItem> next; for (LinkedListNode <BoardItem> linkedListNode = boardCell.Children.First; linkedListNode != null; linkedListNode = next) { next = linkedListNode.Next; this.ImpactTargetFromSplashDamage((SmartEntity)linkedListNode.Value.Data, bullet, splashDamagePercent, ref dictionary); } } } } }
public void RecalculateFlagStampsForShieldBorder(Entity shieldGeneratorEntity, bool shieldUp) { BoardItem boardItem = shieldGeneratorEntity.Get <BoardItemComponent>().BoardItem; WorldController worldController = Service.WorldController; boardItem.CurrentBoard.RemoveFlagStamp(boardItem.FlagStamp); int num = worldController.CalculateWalkableGap(boardItem.Size); FlagStamp flagStamp; if (shieldUp) { ShieldGeneratorComponent sgc = shieldGeneratorEntity.Get <ShieldGeneratorComponent>(); flagStamp = this.CreateFlagStampForShield(sgc, boardItem.Size, num); } else { flagStamp = worldController.CreateFlagStamp(null, null, boardItem.Size, num); } boardItem.FlagStamp = flagStamp; worldController.AddUnWalkableUnDestructibleFlags(boardItem.FlagStamp, boardItem.Size, num, false); boardItem.FlagStamp.CenterTo(boardItem.BoardX + (boardItem.Width - num) / 2, boardItem.BoardZ + (boardItem.Depth - num) / 2); boardItem.CurrentBoard.AddFlagStamp(boardItem.FlagStamp); }
private void AddShieldRegenerationWarBuff(SmartEntity entity, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; BuildingComponent buildingComp = entity.BuildingComp; ShieldGeneratorComponent shieldGeneratorComp = entity.ShieldGeneratorComp; TroopComponent troopComp = entity.TroopComp; TroopShieldHealthComponent troopShieldHealthComp = entity.TroopShieldHealthComp; BuffTypeVO buffType; if (buildingComp != null && shieldGeneratorComp != null) { buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.BuildingBuffUid); } else { if (troopComp == null || troopShieldHealthComp == null) { return; } buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); } this.TryAddBuffStack(entity, buffType, ArmorType.Shield, BuffVisualPriority.SquadWars, entity); entity.BuffComp.SetBuildingLoadedEvent(EventId.ShieldStarted, new VisualReadyDelegate(this.BuildingShieldStarted)); }
public override object Remove(Type compCls) { if (compCls == typeof(AreaTriggerComponent)) { this.AreaTriggerComp = null; } else if (compCls == typeof(ArmoryComponent)) { this.ArmoryComp = null; } else if (compCls == typeof(AssetComponent)) { this.AssetComp = null; } else if (compCls == typeof(AttackerComponent)) { this.AttackerComp = null; } else if (compCls == typeof(BarracksComponent)) { this.BarracksComp = null; } else if (compCls == typeof(BoardItemComponent)) { this.BoardItemComp = null; } else if (compCls == typeof(BuildingAnimationComponent)) { this.BuildingAnimationComp = null; } else if (compCls == typeof(BuildingComponent)) { this.BuildingComp = null; } else if (compCls == typeof(CantinaComponent)) { this.CantinaComp = null; } else if (compCls == typeof(ChampionComponent)) { this.ChampionComp = null; } else if (compCls == typeof(CivilianComponent)) { this.CivilianComp = null; } else if (compCls == typeof(ClearableComponent)) { this.ClearableComp = null; } else if (compCls == typeof(DamageableComponent)) { this.DamageableComp = null; } else if (compCls == typeof(DefenderComponent)) { this.DefenderComp = null; } else if (compCls == typeof(DefenseLabComponent)) { this.DefenseLabComp = null; } else if (compCls == typeof(DroidComponent)) { this.DroidComp = null; } else if (compCls == typeof(DroidHutComponent)) { this.DroidHutComp = null; } else if (compCls == typeof(SquadBuildingComponent)) { this.SquadBuildingComp = null; } else if (compCls == typeof(NavigationCenterComponent)) { this.NavigationCenterComp = null; } else if (compCls == typeof(FactoryComponent)) { this.FactoryComp = null; } else if (compCls == typeof(FleetCommandComponent)) { this.FleetCommandComp = null; } else if (compCls == typeof(FollowerComponent)) { this.FollowerComp = null; } else if (compCls == typeof(GameObjectViewComponent)) { this.GameObjectViewComp = null; } else if (compCls == typeof(GeneratorComponent)) { this.GeneratorComp = null; } else if (compCls == typeof(GeneratorViewComponent)) { this.GeneratorViewComp = null; } else if (compCls == typeof(HealerComponent)) { this.HealerComp = null; } else if (compCls == typeof(HealthComponent)) { this.HealthComp = null; } else if (compCls == typeof(TroopShieldComponent)) { this.TroopShieldComp = null; } else if (compCls == typeof(TroopShieldViewComponent)) { this.TroopShieldViewComp = null; } else if (compCls == typeof(TroopShieldHealthComponent)) { this.TroopShieldHealthComp = null; } else if (compCls == typeof(HealthViewComponent)) { this.HealthViewComp = null; } else if (compCls == typeof(HQComponent)) { this.HQComp = null; } else if (compCls == typeof(KillerComponent)) { this.KillerComp = null; } else if (compCls == typeof(LootComponent)) { this.LootComp = null; } else if (compCls == typeof(MeterShaderComponent)) { this.MeterShaderComp = null; } else if (compCls == typeof(OffenseLabComponent)) { this.OffenseLabComp = null; } else if (compCls == typeof(PathingComponent)) { this.PathingComp = null; } else if (compCls == typeof(SecondaryTargetsComponent)) { this.SecondaryTargetsComp = null; } else if (compCls == typeof(ShieldBorderComponent)) { this.ShieldBorderComp = null; } else if (compCls == typeof(ShieldGeneratorComponent)) { this.ShieldGeneratorComp = null; } else if (compCls == typeof(SizeComponent)) { this.SizeComp = null; } else if (compCls == typeof(ShooterComponent)) { this.ShooterComp = null; } else if (compCls == typeof(StarportComponent)) { this.StarportComp = null; } else if (compCls == typeof(StateComponent)) { this.StateComp = null; } else if (compCls == typeof(StorageComponent)) { this.StorageComp = null; } else if (compCls == typeof(SupportComponent)) { this.SupportComp = null; } else if (compCls == typeof(SupportViewComponent)) { this.SupportViewComp = null; } else if (compCls == typeof(TacticalCommandComponent)) { this.TacticalCommandComp = null; } else if (compCls == typeof(ChampionPlatformComponent)) { this.ChampionPlatformComp = null; } else if (compCls == typeof(TeamComponent)) { this.TeamComp = null; } else if (compCls == typeof(TrackingComponent)) { this.TrackingComp = null; } else if (compCls == typeof(TrackingGameObjectViewComponent)) { this.TrackingGameObjectViewComp = null; } else if (compCls == typeof(TransformComponent)) { this.TransformComp = null; } else if (compCls == typeof(TransportComponent)) { this.TransportComp = null; } else if (compCls == typeof(TroopComponent)) { this.TroopComp = null; } else if (compCls == typeof(TurretBuildingComponent)) { this.TurretBuildingComp = null; } else if (compCls == typeof(TurretShooterComponent)) { this.TurretShooterComp = null; } else if (compCls == typeof(WalkerComponent)) { this.WalkerComp = null; } else if (compCls == typeof(WallComponent)) { this.WallComp = null; } else if (compCls == typeof(BuffComponent)) { this.BuffComp = null; } else if (compCls == typeof(TrapComponent)) { this.TrapComp = null; } else if (compCls == typeof(TrapViewComponent)) { this.TrapViewComp = null; } else if (compCls == typeof(HousingComponent)) { this.HousingComp = null; } else if (compCls == typeof(SpawnComponent)) { this.SpawnComp = null; } return(base.Remove(compCls)); }
protected override Entity AddComponentAndDispatchAddEvent(ComponentBase comp, Type compCls) { bool flag = false; if (comp is AreaTriggerComponent) { this.AreaTriggerComp = (AreaTriggerComponent)comp; flag = true; } if (comp is ArmoryComponent) { this.ArmoryComp = (ArmoryComponent)comp; flag = true; } if (comp is AssetComponent) { this.AssetComp = (AssetComponent)comp; flag = true; } if (comp is AttackerComponent) { this.AttackerComp = (AttackerComponent)comp; flag = true; } if (comp is BarracksComponent) { this.BarracksComp = (BarracksComponent)comp; flag = true; } if (comp is BoardItemComponent) { this.BoardItemComp = (BoardItemComponent)comp; flag = true; } if (comp is BuildingAnimationComponent) { this.BuildingAnimationComp = (BuildingAnimationComponent)comp; flag = true; } if (comp is BuildingComponent) { this.BuildingComp = (BuildingComponent)comp; flag = true; } if (comp is ChampionComponent) { this.ChampionComp = (ChampionComponent)comp; flag = true; } if (comp is CivilianComponent) { this.CivilianComp = (CivilianComponent)comp; flag = true; } if (comp is ClearableComponent) { this.ClearableComp = (ClearableComponent)comp; flag = true; } if (comp is DamageableComponent) { this.DamageableComp = (DamageableComponent)comp; flag = true; } if (comp is DefenderComponent) { this.DefenderComp = (DefenderComponent)comp; flag = true; } if (comp is DefenseLabComponent) { this.DefenseLabComp = (DefenseLabComponent)comp; flag = true; } if (comp is DroidComponent) { this.DroidComp = (DroidComponent)comp; flag = true; } if (comp is DroidHutComponent) { this.DroidHutComp = (DroidHutComponent)comp; flag = true; } if (comp is SquadBuildingComponent) { this.SquadBuildingComp = (SquadBuildingComponent)comp; flag = true; } if (comp is NavigationCenterComponent) { this.NavigationCenterComp = (NavigationCenterComponent)comp; flag = true; } if (comp is FactoryComponent) { this.FactoryComp = (FactoryComponent)comp; flag = true; } if (comp is CantinaComponent) { this.CantinaComp = (CantinaComponent)comp; flag = true; } if (comp is FleetCommandComponent) { this.FleetCommandComp = (FleetCommandComponent)comp; flag = true; } if (comp is FollowerComponent) { this.FollowerComp = (FollowerComponent)comp; flag = true; } if (comp is GameObjectViewComponent) { this.GameObjectViewComp = (GameObjectViewComponent)comp; flag = true; } if (comp is GeneratorComponent) { this.GeneratorComp = (GeneratorComponent)comp; flag = true; } if (comp is GeneratorViewComponent) { this.GeneratorViewComp = (GeneratorViewComponent)comp; flag = true; } if (comp is HealerComponent) { this.HealerComp = (HealerComponent)comp; flag = true; } if (comp is TroopShieldComponent) { this.TroopShieldComp = (TroopShieldComponent)comp; flag = true; } if (comp is TroopShieldViewComponent) { this.TroopShieldViewComp = (TroopShieldViewComponent)comp; flag = true; } if (comp is TroopShieldHealthComponent) { this.TroopShieldHealthComp = (TroopShieldHealthComponent)comp; flag = true; } if (comp is HealthComponent) { this.HealthComp = (HealthComponent)comp; flag = true; } if (comp is HealthViewComponent) { this.HealthViewComp = (HealthViewComponent)comp; flag = true; } if (comp is HQComponent) { this.HQComp = (HQComponent)comp; flag = true; } if (comp is KillerComponent) { this.KillerComp = (KillerComponent)comp; flag = true; } if (comp is LootComponent) { this.LootComp = (LootComponent)comp; flag = true; } if (comp is MeterShaderComponent) { this.MeterShaderComp = (MeterShaderComponent)comp; flag = true; } if (comp is OffenseLabComponent) { this.OffenseLabComp = (OffenseLabComponent)comp; flag = true; } if (comp is PathingComponent) { this.PathingComp = (PathingComponent)comp; flag = true; } if (comp is SecondaryTargetsComponent) { this.SecondaryTargetsComp = (SecondaryTargetsComponent)comp; flag = true; } if (comp is ShieldBorderComponent) { this.ShieldBorderComp = (ShieldBorderComponent)comp; flag = true; } if (comp is ShieldGeneratorComponent) { this.ShieldGeneratorComp = (ShieldGeneratorComponent)comp; flag = true; } if (comp is SizeComponent) { this.SizeComp = (SizeComponent)comp; flag = true; } if (comp is ShooterComponent) { this.ShooterComp = (ShooterComponent)comp; flag = true; } if (comp is StarportComponent) { this.StarportComp = (StarportComponent)comp; flag = true; } if (comp is StateComponent) { this.StateComp = (StateComponent)comp; flag = true; } if (comp is StorageComponent) { this.StorageComp = (StorageComponent)comp; flag = true; } if (comp is SupportComponent) { this.SupportComp = (SupportComponent)comp; flag = true; } if (comp is SupportViewComponent) { this.SupportViewComp = (SupportViewComponent)comp; flag = true; } if (comp is TacticalCommandComponent) { this.TacticalCommandComp = (TacticalCommandComponent)comp; flag = true; } if (comp is ChampionPlatformComponent) { this.ChampionPlatformComp = (ChampionPlatformComponent)comp; flag = true; } if (comp is TeamComponent) { this.TeamComp = (TeamComponent)comp; flag = true; } if (comp is TrackingComponent) { this.TrackingComp = (TrackingComponent)comp; flag = true; } if (comp is TrackingGameObjectViewComponent) { this.TrackingGameObjectViewComp = (TrackingGameObjectViewComponent)comp; flag = true; } if (comp is TransformComponent) { this.TransformComp = (TransformComponent)comp; flag = true; } if (comp is TransportComponent) { this.TransportComp = (TransportComponent)comp; flag = true; } if (comp is TroopComponent) { this.TroopComp = (TroopComponent)comp; flag = true; } if (comp is TurretBuildingComponent) { this.TurretBuildingComp = (TurretBuildingComponent)comp; flag = true; } if (comp is TurretShooterComponent) { this.TurretShooterComp = (TurretShooterComponent)comp; flag = true; } if (comp is WalkerComponent) { this.WalkerComp = (WalkerComponent)comp; flag = true; } if (comp is WallComponent) { this.WallComp = (WallComponent)comp; flag = true; } if (comp is BuffComponent) { this.BuffComp = (BuffComponent)comp; flag = true; } if (comp is TrapComponent) { this.TrapComp = (TrapComponent)comp; flag = true; } if (comp is TrapViewComponent) { this.TrapViewComp = (TrapViewComponent)comp; flag = true; } if (comp is HousingComponent) { this.HousingComp = (HousingComponent)comp; flag = true; } if (comp is ScoutTowerComponent) { this.ScoutTowerComp = (ScoutTowerComponent)comp; flag = true; } if (comp is SpawnComponent) { this.SpawnComp = (SpawnComponent)comp; flag = true; } if (!flag && compCls != null) { Service.Logger.Error("Invalid component add: " + compCls.Name); } return(base.AddComponentAndDispatchAddEvent(comp, compCls)); }
public void KillEntity(Entity entity) { if (entity == null) { return; } SmartEntity smartEntity = (SmartEntity)entity; Service.Get <EventManager>().SendEvent(EventId.PreEntityKilled, entity); bool flag = smartEntity.TroopComp != null; bool flag2 = smartEntity.BuildingComp != null; bool flag3 = flag && smartEntity.TroopComp.TroopType.Type == TroopType.Hero; bool flag4 = smartEntity.TrapComp != null; bool flag5 = smartEntity.ChampionComp != null; BuildingType buildingType = BuildingType.Any; TroopTypeVO troopTypeVO = null; if (flag) { troopTypeVO = Service.Get <IDataController>().Get <TroopTypeVO>(smartEntity.TroopComp.TroopType.Uid); } StateComponent stateComp = smartEntity.StateComp; if (stateComp != null) { stateComp.CurState = EntityState.Dying; if (smartEntity.TroopComp != null && smartEntity.BuffComp != null && troopTypeVO.DeathAnimations != null) { int i = 0; int count = troopTypeVO.DeathAnimations.Count; while (i < count) { string key = troopTypeVO.DeathAnimations[i].get_Key(); if (smartEntity.BuffComp.HasBuff(key)) { int value = troopTypeVO.DeathAnimations[i].get_Value(); stateComp.DeathAnimationID = value; break; } i++; } } } if (smartEntity.BuffComp != null) { smartEntity.BuffComp.Die(); } entity.Remove <SecondaryTargetsComponent>(); entity.Remove <TurretShooterComponent>(); entity.Remove <ShooterComponent>(); entity.Remove <HealthComponent>(); entity.Remove <TrackingComponent>(); entity.Remove <TrackingGameObjectViewComponent>(); entity.Remove <HealthViewComponent>(); entity.Remove <SupportViewComponent>(); entity.Remove <TroopShieldComponent>(); ShieldGeneratorComponent shieldGeneratorComp = smartEntity.ShieldGeneratorComp; ShieldBorderComponent shieldBorderComp = smartEntity.ShieldBorderComp; if (shieldGeneratorComp != null) { SmartEntity smartEntity2 = (SmartEntity)shieldGeneratorComp.ShieldBorderEntity; if (smartEntity2 != null) { Service.Get <ShieldController>().ShieldBorderKilled((SmartEntity)shieldGeneratorComp.ShieldBorderEntity); smartEntity2.Remove <ShieldBorderComponent>(); this.KillEntity(smartEntity2); } } else if (shieldBorderComp != null) { Service.Get <ShieldController>().ShieldBorderKilled((SmartEntity)shieldBorderComp.Entity); SmartEntity smartEntity3 = (SmartEntity)shieldBorderComp.ShieldGeneratorEntity; if (smartEntity3 != null) { smartEntity3.Remove <ShieldGeneratorComponent>(); this.KillEntity(smartEntity3); } } if (flag2 && smartEntity.DamageableComp != null) { entity.Remove <DamageableComponent>(); } if (flag2 && !flag4 && smartEntity.SizeComp != null && smartEntity.GameObjectViewComp != null) { FXManager fXManager = Service.Get <FXManager>(); fXManager.CreateRubbleAtEntityPosition(smartEntity); fXManager.CreateDestructionFX(smartEntity, true); buildingType = smartEntity.BuildingComp.BuildingType.Type; } Service.Get <EntityFactory>().RemoveEntity(entity, buildingType == BuildingType.Trap); entity.Remove <BoardItemComponent>(); Service.Get <EventManager>().SendEvent(EventId.EntityKilled, entity); if (flag3) { Service.Get <EventManager>().SendEvent(EventId.HeroKilled, entity); } else if (flag5) { Service.Get <EventManager>().SendEvent(EventId.ChampionKilled, entity); } if (flag && troopTypeVO != null) { this.entityFader.FadeOut(entity, 5f, 2f, null, new FadingDelegate(this.OnFadeOutComplete)); if (troopTypeVO.Type == TroopType.Vehicle && smartEntity.GameObjectViewComp != null) { Service.Get <FXManager>().CreateDestructionFX(smartEntity, false); } if (troopTypeVO.DeathProjectileType != null) { Vector3 spawnWorldLocation = Vector3.up * -1f; GameObjectViewComponent gameObjectViewComp = smartEntity.GameObjectViewComp; if (gameObjectViewComp != null) { spawnWorldLocation = gameObjectViewComp.MainTransform.position; } int num = 0; bool flag6; Service.Get <ProjectileController>().SpawnProjectileForDeath(spawnWorldLocation, smartEntity, troopTypeVO.DeathProjectileType, troopTypeVO.DeathProjectileDelay, troopTypeVO.DeathProjectileDistance, troopTypeVO.DeathProjectileDamage, out flag6, ref num); if (flag6 && gameObjectViewComp != null) { Service.Get <EntityRenderController>().SetTroopRotation(gameObjectViewComp.MainTransform, (float)num); } } } else if (!flag4) { Service.Get <EntityFactory>().DestroyEntity(entity, false, false); } if (flag2) { Service.Get <EventManager>().SendEvent(EventId.PostBuildingEntityKilled, buildingType); } }