コード例 #1
0
        public void TargetReached(int damagePercent)
        {
            this.m_damageTime = this.GetProjectileData().GetDamageDelay();
            this.UpdateDamage(damagePercent);
            this.m_targetReached = true;

            if (!this.m_dummy)
            {
                if (this.m_hitEffect != null)
                {
                    if (this.m_target != null)
                    {
                        LogicHitpointComponent hitpointComponent = this.m_target.GetHitpointComponent();

                        if (hitpointComponent != null)
                        {
                            if (!this.m_bounceProjectile)
                            {
                                // Listener.
                            }
                        }
                    }
                    else if (!this.m_penetrating && this.m_shockwavePushStrength == 0)
                    {
                        // Listener.
                    }
                }

                if (this.m_hitEffect2 != null)
                {
                    if (this.m_target != null)
                    {
                        LogicHitpointComponent hitpointComponent = this.m_target.GetHitpointComponent();

                        if (hitpointComponent != null)
                        {
                            if (!this.m_bounceProjectile)
                            {
                                // Listener.
                            }
                        }
                    }
                    else if (!this.m_penetrating && this.m_shockwavePushStrength == 0)
                    {
                        // Listener.
                    }
                }

                if (this.m_target != null)
                {
                    if (this.m_bounceCount > 0)
                    {
                        this.m_bounceTargets[this.m_bounceCount - 1] = this.m_target;
                        this.UpdateBounces();
                    }
                }

                LogicSpellData hitSpell = this.GetProjectileData().GetHitSpell();

                if (hitSpell != null)
                {
                    LogicSpell spell = (LogicSpell)LogicGameObjectFactory.CreateGameObject(hitSpell, this.m_level, this.m_villageType);

                    spell.SetUpgradeLevel(this.GetProjectileData().GetHitSpellLevel());
                    spell.SetInitialPosition(this.GetMidX(), this.GetMidY());
                    spell.SetTeam(1);

                    this.GetGameObjectManager().AddGameObject(spell, -1);
                }

                if (this.m_bounceProjectile)
                {
                    int idx = -1;

                    for (int i = 0; i < LogicProjectile.MAX_BOUNCES; i++)
                    {
                        if (this.m_bouncePositions[i] != null)
                        {
                            idx = i;
                            break;
                        }
                    }

                    if (idx != -1)
                    {
                        LogicVector2 bouncePosition = this.m_bouncePositions[idx];

                        this.m_bouncePositions[idx] = null;
                        this.m_target = null;

                        LogicEffectData bounceEffect = this.GetProjectileData().GetBounceEffect();

                        if (bounceEffect != null)
                        {
                            this.m_listener.PlayEffect(bounceEffect);
                        }

                        this.m_targetPosition.m_x = 8 * bouncePosition.m_x;
                        this.m_targetPosition.m_y = 8 * bouncePosition.m_y;

                        this.m_randomHitRange = this.m_flyingTarget ? 1000 : 0;

                        // Listener.

                        this.m_targetReached = false;
                        this.m_travelTime    = 0;

                        bouncePosition.Destruct();
                    }
                    else
                    {
                        this.m_target = null;
                    }
                }

                if (this.m_targetReached)
                {
                    LogicEffectData destroyedEffect = this.GetProjectileData().GetDestroyedEffect();

                    if (destroyedEffect != null)
                    {
                        // Listener.
                    }
                }
            }
        }
コード例 #2
0
        public override void Tick()
        {
            base.Tick();

            if (this.m_constructionTimer != null)
            {
                if (this.m_level.GetRemainingClockTowerBoostTime() > 0 &&
                    this.m_data.GetVillageType() == 1)
                {
                    this.m_constructionTimer.SetFastForward(this.m_constructionTimer.GetFastForward() + 4 * LogicDataTables.GetGlobals().GetClockTowerBoostMultiplier() - 4);
                }

                if (this.m_constructionTimer.GetRemainingSeconds(this.m_level.GetLogicTime()) <= 0)
                {
                    this.FinishConstruction(false);
                }
            }

            if (this.m_disarmed)
            {
                if (this.m_fadeTime >= 0)
                {
                    this.m_fadeTime = LogicMath.Min(this.m_fadeTime + 64, 1000);
                }
            }

            LogicTriggerComponent triggerComponent = this.GetTriggerComponent();

            if (triggerComponent.IsTriggered() && !this.m_disarmed && !this.m_upgrading)
            {
                LogicTrapData data = this.GetTrapData();

                if (this.m_numSpawns > 0)
                {
                    if (this.m_spawnInitDelay != 0)
                    {
                        this.m_spawnInitDelay -= 1;
                    }
                    else
                    {
                        this.SpawnUnit(1);
                        this.m_numSpawns     -= 1;
                        this.m_spawnInitDelay = this.GetTrapData().GetTimeBetweenSpawnsMS() / 64;
                    }
                }

                if (this.m_actionTime >= 0)
                {
                    this.m_actionTime += 64;
                }

                if (this.m_hitTime >= 0)
                {
                    this.m_hitTime += 64;
                }

                if (this.m_actionTime > data.GetActionFrame())
                {
                    this.m_hitTime    = data.GetHitDelayMS();
                    this.m_actionTime = -1;
                }
                else if (this.m_hitTime > data.GetHitDelayMS())
                {
                    if (data.GetSpell() != null)
                    {
                        LogicSpell spell = (LogicSpell)LogicGameObjectFactory.CreateGameObject(data.GetSpell(), this.m_level, this.m_villageType);

                        spell.SetUpgradeLevel(0);
                        spell.SetInitialPosition(this.GetMidX(), this.GetMidY());
                        spell.SetTeam(1);

                        this.GetGameObjectManager().AddGameObject(spell, -1);
                    }
                    else if (data.GetProjectile(this.m_upgLevel) != null)
                    {
                        this.CreateProjectile(data.GetProjectile(this.m_upgLevel));
                    }
                    else if (data.GetDamageMod() != 0)
                    {
                        this.m_level.AreaBoost(this.GetMidX(), this.GetMidY(), data.GetDamageRadius(this.m_upgLevel), -data.GetSpeedMod(), -data.GetSpeedMod(), data.GetDamageMod(),
                                               0, data.GetDurationMS() / 16, 0, false);
                    }
                    else if (data.GetEjectVictims())
                    {
                        if (data.GetThrowDistance() <= 0)
                        {
                            this.EjectCharacters();
                        }
                        else
                        {
                            this.ThrowCharacters();
                        }
                    }
                    else
                    {
                        bool defaultMode = true;

                        if (data.GetSpawnedCharAir() != null && data.GetSpawnedCharGround() != null || data.HasAlternativeMode())
                        {
                            int activeLayout = this.m_level.GetActiveLayout();

                            if (activeLayout <= 7)
                            {
                                defaultMode = this.m_useAirMode[activeLayout] ^ true;
                            }
                        }

                        this.m_level.AreaDamage(0, this.GetMidX(), this.GetMidY(), data.GetDamageRadius(this.m_upgLevel), data.GetDamage(this.m_upgLevel),
                                                data.GetPreferredTarget(),
                                                data.GetPreferredTargetDamageMod(), data.GetDamageEffect(), 1, null, defaultMode ? 1 : 0, 0, 100, true, false, 100, 0, this, 100,
                                                0);
                    }

                    this.m_hitTime   = 0;
                    this.m_hitCount += 1;

                    if (this.m_hitCount >= data.GetHitCount() && this.m_numSpawns == 0)
                    {
                        this.m_fadeTime       = 1;
                        this.m_hitTime        = -1;
                        this.m_disarmed       = true;
                        this.m_numSpawns      = data.GetNumSpawns(this.m_upgLevel);
                        this.m_spawnInitDelay = data.GetSpawnInitialDelayMS() / 64;
                    }
                }
            }
        }