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 void ShieldBorderKilled(SmartEntity shieldBorderEntity) { if (shieldBorderEntity != null) { ShieldBorderComponent shieldBorderComp = shieldBorderEntity.ShieldBorderComp; if (shieldBorderComp != null) { this.RecalculateFlagStampsForShieldBorder(shieldBorderComp.ShieldGeneratorEntity, false); Service.EventManager.SendEvent(EventId.ShieldBorderDestroyed, shieldBorderComp); } } }
public EatResponse OnEvent(EventId id, object cookie) { IState currentState = Service.GameStateMachine.CurrentState; switch (id) { case EventId.BuildingSelected: { Entity entity = cookie as Entity; if (entity.Has <ShieldGeneratorComponent>() && !GameUtils.IsVisitingBase()) { this.effects.PlayAllEffects(true); Service.AudioManager.PlayAudio("sfx_shields_power_up"); } return(EatResponse.NotEaten); } case EventId.BuildingSelectedSound: IL_20: if (id != EventId.BuildingViewReady) { if (id == EventId.EntityHit) { Bullet bullet = cookie as Bullet; ShieldBorderComponent shieldBorderComp = bullet.Target.ShieldBorderComp; if (shieldBorderComp != null) { this.OnDamageShieldBorder(shieldBorderComp.ShieldGeneratorEntity, bullet); } return(EatResponse.NotEaten); } if (id == EventId.BuildingReplaced) { SmartEntity smartEntity = cookie as SmartEntity; if (smartEntity.ShieldGeneratorComp != null) { this.replacedEntities.Add(cookie as Entity); } return(EatResponse.NotEaten); } if (id == EventId.WorldLoadComplete) { this.effects.Cleanup(); this.replacedEntities.Clear(); if (GameUtils.IsVisitingBase()) { this.effects.PlayAllEffects(true); } return(EatResponse.NotEaten); } if (id != EventId.ShieldBorderDestroyed) { return(EatResponse.NotEaten); } ShieldBorderComponent sbc = cookie as ShieldBorderComponent; this.OnDestroyShieldBorder(sbc); return(EatResponse.NotEaten); } else { if (!(currentState is HomeState) && !(currentState is EditBaseState)) { return(EatResponse.NotEaten); } EntityViewParams entityViewParams = cookie as EntityViewParams; if (this.replacedEntities.Contains(entityViewParams.Entity)) { this.InitializeEffects(entityViewParams.Entity); this.replacedEntities.Remove(entityViewParams.Entity); } return(EatResponse.NotEaten); } break; case EventId.BuildingDeselected: { Entity entity2 = cookie as Entity; if (entity2.Has <ShieldGeneratorComponent>() && !GameUtils.IsVisitingBase()) { this.StopAllEffects(); } return(EatResponse.NotEaten); } } goto IL_20; }
private void OnDestroyShieldBorder(ShieldBorderComponent sbc) { this.effects.PowerDownShieldEffect(sbc.ShieldGeneratorEntity); this.effects.PlayDestructionEffect(sbc.ShieldGeneratorEntity); }
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); } }