private SmartEntity CreateChampionEntity(TroopTypeVO championType, SmartEntity building) { TransformComponent transformComp = building.TransformComp; SmartEntity smartEntity = Service.Get <EntityFactory>().CreateChampionEntity(championType, new IntPosition(transformComp.CenterGridX(), transformComp.CenterGridZ())); Service.Get <BoardController>().Board.AddChild(smartEntity.BoardItemComp.BoardItem, transformComp.X, transformComp.Z, null, false); Service.Get <EntityController>().AddEntity(smartEntity); return(smartEntity); }
public void HideBuildingTooltip(SmartEntity building) { SupportViewComponent supportViewComp = building.SupportViewComp; if (supportViewComp != null) { supportViewComp.TeardownElements(); } }
private void DestroyChampionEntity(TroopTypeVO championType) { SmartEntity smartEntity = this.FindChampionEntity(championType); if (smartEntity != null) { Service.Get <EntityFactory>().DestroyEntity(smartEntity, true, false); } }
public static void OnPayMeForCurrencyResultSingleTrap(object result, object cookie) { SmartEntity selectedBuilding = Service.BuildingController.SelectedBuilding; if (GameUtils.HandleSoftCurrencyFlow(result, cookie)) { TrapUtils.RearmSingleTrap(selectedBuilding); } }
private void ActivateChampion() { SmartEntity defensiveChampion = ((SmartEntity)this.Owner).ChampionPlatformComp.DefensiveChampion; if (defensiveChampion != null) { defensiveChampion.ShooterComp.AttackFSM.Activate(); } }
private void RemoveTroopAbilitySelfBuff(SmartEntity troop) { BuffTypeVO troopAbilitySelfBuffType = this.GetTroopAbilitySelfBuffType(troop); if (troopAbilitySelfBuffType != null) { this.RemoveBuffStack(troop, troopAbilitySelfBuffType); } }
public void ApplyActiveBuffs(SmartEntity target, BuffModify modify, ref int modifyValue, int modifyValueMax) { BuffComponent buffComp = target.BuffComp; if (buffComp != null) { buffComp.ApplyActiveBuffs(modify, ref modifyValue, modifyValueMax); } }
private void ImpactTargetFromSplashDamage(SmartEntity target, Bullet bullet, int effectiveDamagePercentage, ref Dictionary <Entity, bool> entitiesHit) { if (!entitiesHit.ContainsKey(target)) { entitiesHit.Add(target, true); bullet.SetTarget(target); this.ImpactSingleTarget(bullet, effectiveDamagePercentage, true, false); } }
private void AddTroopAbilitySelfBuff(SmartEntity troop) { BuffTypeVO troopAbilitySelfBuffType = this.GetTroopAbilitySelfBuffType(troop); if (troopAbilitySelfBuffType != null) { this.TryAddBuffStack(troop, troopAbilitySelfBuffType, troop.TroopComp.TroopType.ArmorType, BuffVisualPriority.SelfAbility); } }
public DeployedTroop(string uid, SmartEntity entity) { this.Uid = uid; this.Entity = entity; this.AbilityTimer = 0u; this.CoolDownTimer = 0u; this.AbilityClipCount = 0; this.Activated = false; }
private void UpdateArmoryBuildingTooltip() { SmartEntity smartEntity = (SmartEntity)Service.Get <BuildingLookupController>().GetCurrentArmory(); if (smartEntity != null) { Service.Get <BuildingTooltipController>().EnsureBuildingTooltip(smartEntity); } }
private bool StopAttackingIfAttacking(SmartEntity troop) { if (troop.ShooterComp.AttackFSM.IsAttacking) { troop.ShooterComp.AttackFSM.StopAttacking(true); return(true); } return(false); }
public BeamTarget(SmartEntity target) { this.Target = target; this.IsFirstHit = true; this.HitThisSegment = false; this.TotalHitCount = 0; this.CurDamagePercent = 0; this.maxDamagePercent = 0; }
private bool UpdateShooterTargetIfNotNull(SmartEntity shooter, SmartEntity target) { if (target != null) { shooter.ShooterComp.Target = target; return(true); } return(false); }
private bool IsEntityEligible(SmartEntity smartEntity) { if (smartEntity.BuildingComp != null) { BuildingType buildingTypeFromBuilding = this.GetBuildingTypeFromBuilding(smartEntity); return(this.IsBuildingTypeEligible(buildingTypeFromBuilding) && this.IsEntityEligibleForEligibleBuildingType(smartEntity)); } return(false); }
protected override void SetSelectedBuilding(SmartEntity newSelectedBuilding) { base.SetSelectedBuilding(newSelectedBuilding); BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog; this.nextBuildingInfo = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo); this.maxBuildingInfo = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup); this.reqMet = Service.UnlockController.IsUnlocked(this.nextBuildingInfo, 1, out this.reqBuildingInfo); }
private void OnTargetingDone(SmartEntity entity) { TroopComponent troopComp = entity.ShooterComp.Target.TroopComp; if (troopComp != null) { troopComp.TargetCount++; } }
private FinishNowScreen() : base(false, null, null, null, false) { this.buildingEntity = null; this.perkId = null; this.currentContract = null; this.noContract = true; this.displayName = string.Empty; this.RefreshData(); }
private void ActivateShieldCallback(uint id, object cookie) { SmartEntity smartEntity = this.Entity as SmartEntity; if (smartEntity != null && smartEntity.StateComp != null && !smartEntity.StateComp.IsRunning) { this.PlayActivateAnimation(); } }
private void StartLiftingBuilding(SmartEntity building) { if (!Service.UserInputInhibitor.IsDenying()) { this.ApplyLiftingEffect(building); this.liftTimerId = Service.ViewTimerManager.CreateViewTimer(1f, false, new TimerDelegate(this.OnLiftTimer), null); } this.liftingBuilding = building; }
public static string GetDebrisAssetNameForEntity(SmartEntity entity, bool isBuilding) { SizeComponent sizeComp = entity.SizeComp; int val = Units.BoardToGridX(sizeComp.Width); int val2 = Units.BoardToGridZ(sizeComp.Depth); int num = Math.Min(val, val2); string uid; if (isBuilding) { BuildingTypeVO buildingType = entity.BuildingComp.BuildingType; string text = string.IsNullOrEmpty(buildingType.DestructFX) ? "fx_debris_{0}x{1}" : buildingType.DestructFX; BuildingType type = buildingType.Type; if (type != BuildingType.Wall) { if (type != BuildingType.Turret) { if (type != BuildingType.ShieldGenerator) { uid = string.Format(text, new object[] { num, num }); } else { uid = "fx_debris_6x6"; } } else { uid = ((buildingType.Faction == FactionType.Tusken) ? "effect176" : string.Format(text, new object[] { num, num })); } } else { uid = "effect176"; } } else { uid = string.Format("fx_vehdebris_{0}x{1}", new object[] { num, num }); } EffectsTypeVO effectsTypeVO = Service.Get <IDataController>().Get <EffectsTypeVO>(uid); return(effectsTypeVO.AssetName); }
protected bool IsTargetInRange(ShooterComponent shooterComp, SmartEntity target) { if (target.ShieldBorderComp != null) { return(true); } int squaredDistanceToTarget = GameUtils.GetSquaredDistanceToTarget(shooterComp, target); return(this.shooterController.InRange(squaredDistanceToTarget, shooterComp)); }
private bool WillCrushNearTarget(SmartEntity troop, SmartEntity target) { if (!TroopController.CanEntityCrushWalls(troop)) { return(false); } BuildingComponent buildingComp = target.BuildingComp; return(buildingComp != null && buildingComp.BuildingType.Type == BuildingType.Wall); }
private void RemoveBuffStack(SmartEntity target, BuffTypeVO buffType) { BuffComponent buffComp = target.BuffComp; if (buffComp == null) { return; } buffComp.RemoveBuffStack(buffType); }
private static void SetStarportFullnessPercent(SmartEntity starport, float percent) { MeterShaderComponent meterShaderComp = starport.MeterShaderComp; if (meterShaderComp != null) { meterShaderComp.UpdatePercentage(percent); Service.EventManager.SendEvent(EventId.StarportMeterUpdated, meterShaderComp); } }
public ShuttleAnim GetShuttleForStarport(SmartEntity starport) { ShuttleAnim result = null; if (this.shuttles.ContainsKey(starport)) { result = this.shuttles[starport]; } return(result); }
public void Reset() { this.TimeOnSegment = 0u; this.TimeToMove = 0; this.Target = null; this.CurrentPath = null; this.nextTileIndex = 0; this.EndCell = null; this.TargetCell = null; }
private bool UpdateShooterTargetIfDistinct(SmartEntity shooter, SmartEntity target) { if (target != shooter.ShooterComp.Target) { this.InvalidateCurrentTarget(shooter); shooter.ShooterComp.Target = target; return(target != null); } return(false); }
public void OnPathingComplete(SmartEntity self, SecondaryTargetsComponent secondaryTargetsComp, StateComponent stateComp, ShooterComponent shooterComp, SmartEntity target) { this.UpdateAlterantiveTargets(secondaryTargetsComp, self, target); this.shooterController.StartMoving(self); if (!shooterComp.FirstTargetAcquired || (target.BuildingComp != null && target.BuildingComp.BuildingType.ShowReticleWhenTargeted)) { shooterComp.FirstTargetAcquired = true; this.OnTroopAcquiredFirstTarget(self); } }
private void FindIfTroopIsInRangeOfTrigger(SmartEntity entity) { TransformComponent transformComp = entity.TransformComp; List <ElementPriorityPair <Entity> > areaTriggerBuildingsInRangeOf = this.spatialIndexController.GetAreaTriggerBuildingsInRangeOf(transformComp.CenterGridX(), transformComp.CenterGridZ()); if (areaTriggerBuildingsInRangeOf != null && areaTriggerBuildingsInRangeOf.Count > 0) { this.combatTriggerManager.InformAreaTriggerBuildings(areaTriggerBuildingsInRangeOf, entity); } }