示例#1
0
        public override void OnInteract(Projectile projectile)
        {
            //Checks if the projectile is already under influence of this weather
            if (CheckWeatherInfluence(projectile))
            {
                return;
            }

            //Passes this instance to any projectile's dependent projectile
            projectile.OnBeginElectricityInteraction(this);

            //If the project can't collide, it should not be taken into consideration for spawning/explosion effects
            if (!projectile.CanCollide)
            {
                return;
            }

            //Once added to the list, the projectile starts spawning electrical particles around it's flipbook
            SpecialEffect se = SpecialEffectBuilder.ElectricityParticle(projectile.Position);

            projectile.OnAfterUpdateAction += () =>
            {
                se.Flipbook.Position = projectile.Position;
                se.Flipbook.Rotation = projectile.CurrentFlipbookRotation;
            };

            //Install itself on the projectile explosion event forcing every exploding projectile to be removed from the spawning list
            Action removeParticle = () => SpecialEffectHandler.Remove(se);

            projectile.OnExplodeAction        += removeParticle;
            projectile.OnBeingDestroyedAction += removeParticle;

            projectile.OnExplodeAction += () =>
            {
                LightningBaseProjectile ep = new LightningBaseProjectile(projectile.Mobile, projectile.Position,
                                                                         MathHelper.PiOver2,
                                                                         Parameter.WeatherEffectElectricityExplosionRadius,
                                                                         Parameter.WeatherEffectElectricityEExplosionRadius,
                                                                         Parameter.WeatherEffectElectricityBaseDamage,
                                                                         Parameter.WeatherEffectElectricityEBaseDamage);

                ep.Update();

                AudioHandler.PlaySoundEffect("Audio/SFX/Tank/Blast/LightningS1");
            };
        }
示例#2
0
        protected override void Destroy()
        {
            base.Destroy();

            //Destroy the trace
            SpecialEffectHandler.Remove(swordTrace);

            //If this shot is the last one the satellite should reappear
            if (Mobile.ProjectileList.Except(Mobile.UnusedProjectile).Count() == 0)
            {
                OnFinalizeExecutionAction?.Invoke();

                //Show element
                if (baseShotType != ShotType.SS)
                {
                    SpecialEffectBuilder.TeleportFlame2(((Knight)Mobile).Satellite.Flipbook.Position, 0.5f);
                }

                ((Knight)Mobile).Satellite.Flipbook.ShowElement();
            }
        }