Example #1
0
        public override void Draw(GameTime gameTime)
        {
            Camera.Draw(spriteBatch);
            Cursor.Instance.Draw(gameTime, spriteBatch);

            if (!Parameter.ShouldChangeBGScale)
            {
                Background.Draw(gameTime, spriteBatch);
            }

            PopupHandler.Draw(gameTime, spriteBatch);

            if (!Parameter.ShouldChangeBGScale)
            {
                BackgroundFlipbookList.ForEach((x) => x.Draw(gameTime, spriteBatch));
            }

            Foreground.Draw(gameTime, spriteBatch);

            WeatherHandler.Draw(gameTime, spriteBatch);

            lock (MobileList)
            {
                MobileList.ForEach((x) => x.Draw(gameTime, spriteBatch));
                HUD.Draw(gameTime, spriteBatch);
            }

            MineList.ForEach((x) => x.Draw(gameTime, spriteBatch));

            ThorSatellite.Draw(gameTime, spriteBatch);

            DeathAnimation.Draw(gameTime, spriteBatch);
            SpecialEffectHandler.Draw(gameTime, spriteBatch);
            TextBalloonHandler.Draw(spriteBatch);
        }
Example #2
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");
            };
        }
Example #3
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();
            }
        }
Example #4
0
        public override void Initialize(GraphicsDevice GraphicsDevice, SpriteBatch SpriteBatch)
        {
            base.Initialize(GraphicsDevice, SpriteBatch);

            //Initializing HUD component
            HUD = new HUD(ownedMobile, MobileList);

            //Extract terrain geography
            Topography.Initialize(Foreground);

            MobileList.ForEach((x) =>
            {
                //Repositioning the actors in order to accurately reproduce the scenario coordinate showed in the loading screen
                //This must be called here because in this position the background will be already initialized
                x.Position -= Foreground.Pivot;

                //Define the spawning points for each remote mobile
                if (!x.IsPlayable)
                {
                    ((RemoteMovement)x.Movement).DesiredPosition = x.Position;
                }
            });

            //Start all mobiles facing trajectory
            StartMobileFacingTrajectory();

            //Parallax Vectors
            BackgroundRemainingImage = new Vector2(Background.SpriteWidth, Background.SpriteHeight) - Parameter.ScreenResolution;

            //Clear all sfx from the list
            SpecialEffectHandler.Initialize();

            //Clear all pending death animations
            DeathAnimation.Initialize();

            //Start Match
#if !DEBUGSCENE
            ServerInformationHandler.StartMatch();
#endif
        }
Example #5
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            WeatherHandler.Update(gameTime);

            lock (MobileList)
            {
                MobileList.ForEach((m) => m.Update(gameTime));
                HUD.Update(gameTime);
                OnFinalizeUpdatingMobiles?.Invoke();

                MineList.ForEach((x) => x.Update(gameTime));
                ToBeRemovedMineList.ForEach((x) => MineList.Remove(x));
                ToBeRemovedMineList.Clear();

                UpdateBackgroundParallaxPosition();

                ThorSatellite.Update(gameTime);
            }

            DeathAnimation.Update(gameTime);
            SpecialEffectHandler.Update(gameTime);
        }