Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void HideBuildingTooltip(SmartEntity building)
        {
            SupportViewComponent supportViewComp = building.SupportViewComp;

            if (supportViewComp != null)
            {
                supportViewComp.TeardownElements();
            }
        }
Esempio n. 3
0
        private void DestroyChampionEntity(TroopTypeVO championType)
        {
            SmartEntity smartEntity = this.FindChampionEntity(championType);

            if (smartEntity != null)
            {
                Service.Get <EntityFactory>().DestroyEntity(smartEntity, true, false);
            }
        }
Esempio n. 4
0
        public static void OnPayMeForCurrencyResultSingleTrap(object result, object cookie)
        {
            SmartEntity selectedBuilding = Service.BuildingController.SelectedBuilding;

            if (GameUtils.HandleSoftCurrencyFlow(result, cookie))
            {
                TrapUtils.RearmSingleTrap(selectedBuilding);
            }
        }
Esempio n. 5
0
        private void ActivateChampion()
        {
            SmartEntity defensiveChampion = ((SmartEntity)this.Owner).ChampionPlatformComp.DefensiveChampion;

            if (defensiveChampion != null)
            {
                defensiveChampion.ShooterComp.AttackFSM.Activate();
            }
        }
Esempio n. 6
0
        private void RemoveTroopAbilitySelfBuff(SmartEntity troop)
        {
            BuffTypeVO troopAbilitySelfBuffType = this.GetTroopAbilitySelfBuffType(troop);

            if (troopAbilitySelfBuffType != null)
            {
                this.RemoveBuffStack(troop, troopAbilitySelfBuffType);
            }
        }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 8
0
 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);
     }
 }
Esempio n. 9
0
        private void AddTroopAbilitySelfBuff(SmartEntity troop)
        {
            BuffTypeVO troopAbilitySelfBuffType = this.GetTroopAbilitySelfBuffType(troop);

            if (troopAbilitySelfBuffType != null)
            {
                this.TryAddBuffStack(troop, troopAbilitySelfBuffType, troop.TroopComp.TroopType.ArmorType, BuffVisualPriority.SelfAbility);
            }
        }
Esempio n. 10
0
 public DeployedTroop(string uid, SmartEntity entity)
 {
     this.Uid              = uid;
     this.Entity           = entity;
     this.AbilityTimer     = 0u;
     this.CoolDownTimer    = 0u;
     this.AbilityClipCount = 0;
     this.Activated        = false;
 }
Esempio n. 11
0
        private void UpdateArmoryBuildingTooltip()
        {
            SmartEntity smartEntity = (SmartEntity)Service.Get <BuildingLookupController>().GetCurrentArmory();

            if (smartEntity != null)
            {
                Service.Get <BuildingTooltipController>().EnsureBuildingTooltip(smartEntity);
            }
        }
Esempio n. 12
0
 private bool StopAttackingIfAttacking(SmartEntity troop)
 {
     if (troop.ShooterComp.AttackFSM.IsAttacking)
     {
         troop.ShooterComp.AttackFSM.StopAttacking(true);
         return(true);
     }
     return(false);
 }
Esempio n. 13
0
 public BeamTarget(SmartEntity target)
 {
     this.Target           = target;
     this.IsFirstHit       = true;
     this.HitThisSegment   = false;
     this.TotalHitCount    = 0;
     this.CurDamagePercent = 0;
     this.maxDamagePercent = 0;
 }
Esempio n. 14
0
 private bool UpdateShooterTargetIfNotNull(SmartEntity shooter, SmartEntity target)
 {
     if (target != null)
     {
         shooter.ShooterComp.Target = target;
         return(true);
     }
     return(false);
 }
Esempio n. 15
0
 private bool IsEntityEligible(SmartEntity smartEntity)
 {
     if (smartEntity.BuildingComp != null)
     {
         BuildingType buildingTypeFromBuilding = this.GetBuildingTypeFromBuilding(smartEntity);
         return(this.IsBuildingTypeEligible(buildingTypeFromBuilding) && this.IsEntityEligibleForEligibleBuildingType(smartEntity));
     }
     return(false);
 }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        private void OnTargetingDone(SmartEntity entity)
        {
            TroopComponent troopComp = entity.ShooterComp.Target.TroopComp;

            if (troopComp != null)
            {
                troopComp.TargetCount++;
            }
        }
Esempio n. 18
0
 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();
 }
Esempio n. 19
0
        private void ActivateShieldCallback(uint id, object cookie)
        {
            SmartEntity smartEntity = this.Entity as SmartEntity;

            if (smartEntity != null && smartEntity.StateComp != null && !smartEntity.StateComp.IsRunning)
            {
                this.PlayActivateAnimation();
            }
        }
Esempio n. 20
0
 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;
 }
Esempio n. 21
0
        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);
        }
Esempio n. 22
0
        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));
        }
Esempio n. 23
0
        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);
        }
Esempio n. 24
0
        private void RemoveBuffStack(SmartEntity target, BuffTypeVO buffType)
        {
            BuffComponent buffComp = target.BuffComp;

            if (buffComp == null)
            {
                return;
            }
            buffComp.RemoveBuffStack(buffType);
        }
Esempio n. 25
0
        private static void SetStarportFullnessPercent(SmartEntity starport, float percent)
        {
            MeterShaderComponent meterShaderComp = starport.MeterShaderComp;

            if (meterShaderComp != null)
            {
                meterShaderComp.UpdatePercentage(percent);
                Service.EventManager.SendEvent(EventId.StarportMeterUpdated, meterShaderComp);
            }
        }
Esempio n. 26
0
        public ShuttleAnim GetShuttleForStarport(SmartEntity starport)
        {
            ShuttleAnim result = null;

            if (this.shuttles.ContainsKey(starport))
            {
                result = this.shuttles[starport];
            }
            return(result);
        }
Esempio n. 27
0
 public void Reset()
 {
     this.TimeOnSegment = 0u;
     this.TimeToMove    = 0;
     this.Target        = null;
     this.CurrentPath   = null;
     this.nextTileIndex = 0;
     this.EndCell       = null;
     this.TargetCell    = null;
 }
Esempio n. 28
0
 private bool UpdateShooterTargetIfDistinct(SmartEntity shooter, SmartEntity target)
 {
     if (target != shooter.ShooterComp.Target)
     {
         this.InvalidateCurrentTarget(shooter);
         shooter.ShooterComp.Target = target;
         return(target != null);
     }
     return(false);
 }
Esempio n. 29
0
 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);
     }
 }
Esempio n. 30
0
        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);
            }
        }