public static void Load()
        {
            TextParticleSystem.Load();
            if (!Loaded)
            {
                ParticleEffect  = AssetManager.Load <Effect>("Effects/ShipGame/ShipParticles");
                ParticleSystems = new BasicParticleSystem[8];

                ParticleSystems[0] = new ShipParticleSystem(2000, 0.6f, 2, "Smoke", 1, 2f);
                ParticleSystems[1] = new FlareSystem(5000, 20, "Flare");
                ParticleSystems[2] = new ShipParticleSystem(2000, 0.1f, 2, "Smoke", 1, 1f);
                ParticleSystems[3] = new FlamingChunkSystem(100);
                ParticleSystems[4] = new ShipParticleSystem(100, 0.25f, 0, "Ring", 0, 2f);
                ParticleSystems[5] = new ShipParticleSystem(2000, 1f, 0, "Spark", 1, 0);
                ParticleSystems[6] = new ShipParticleSystem(50, 4, 0, "Ring", 0.1f, 2f);
                ParticleSystems[7] = new LineParticleSystem(1000, 10);

                for (int i = 0; i < ParticleSystems.Length; i++)
                {
                    ColorParticleSystem.AddLast(ParticleSystems[i]);
                }

                ringSystem = new RingSystem(250, "Ring");

                Loaded = true;
            }
            else
            {
                foreach (BasicParticleSystem system in ParticleSystems)
                {
                    system.Clear();
                }
            }
        }
        public void MakeMoney()
        {
            if (WaveManager.ActiveTeam == GetTeam())
            {
                UpdateMapPosition();

                int ProdBase = MyRock.ProductionAmount.get();
                if (IsUpdgraded)
                {
                    ProdBase += 100;
                }
                if (WaveManager.CurrentWave > 15)
                {
                    ProdBase *= 2;
                }

                if (BonusProduction)
                {
                    ProdBase *= WaveManager.GameSpeed;
                }
                else
                {
                    BonusProduction = true;
                }

                int Production = ProdBase;


                if (Production > 0)
                {
                    FactionManager.AddCells(FactionNumber, Production);
                    TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), Production.ToString(), (byte)GetTeam(), TextParticleSystemIcons.CellsTexture);
                }
            }
        }
        public override void Damage(float damage, float pushTime, Vector2 pushSpeed, BasicShipGameObject Damager, AttackType attackType)
        {
            float PreviousShieldDamage = Math.Min(ShieldDamage, ShieldToughness);
            float PreviousHullDamage   = Math.Min(HullDamage, HullToughness);

            base.Damage(damage, pushTime, pushSpeed, Damager, attackType);

            float DamageAmount = (Math.Min(ShieldDamage, ShieldToughness) - PreviousShieldDamage) + (Math.Min(HullDamage, HullToughness) - PreviousHullDamage);

            if (DamageAmount > 0)
            {
                if (DamageAmount > 0.25f)
                {
                    TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), ((int)(DamageAmount * 4)).ToString(), (byte)Damager.GetTeam());
                }

                if (Damager.GetType().IsSubclassOf(typeof(UnitShip)))
                {
                    UnitShip s = (UnitShip)Damager;
                    //if (s.IsGhostMode)
                    //  return;
                }

                if (Damager.GetTeam() == NeutralManager.NeutralTeam)
                {
                    FactionManager.AddDamage(DamageAmount * 4);
                }
                else
                {
                    FactionManager.AddDamage(Damager.GetTeam(), DamageAmount * 4);
                }
            }
        }
 public static void Update(GameTime gameTime)
 {
     TextParticleSystem.Update(gameTime);
     foreach (BasicParticleSystem r in ParticleSystems)
     {
         r.Update(gameTime);
     }
     ringSystem.Update(gameTime);
 }
Example #5
0
 public void MakeMoney()
 {
     if (WaveManager.ActiveTeam == GetTeam())
     {
         FactionManager.AddEnergy(FactionNumber, Production);
         FactionManager.AddCells(FactionNumber, Production);
         TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), Production.ToString(), (byte)GetTeam(), TextParticleSystemIcons.CellsTexture);
     }
 }
        public override void Damage(float damage, float pushTime, Vector2 pushSpeed, BasicShipGameObject Damager, AttackType attackType)
        {
            if ((InvTime < 1 && (FieldStateTime < 1 || fieldState != FieldState.Cloaked)) || attackType == AttackType.Explosion || attackType == AttackType.Melee)
            {
                if (CanCloak)
                {
                    SoundManager.Play3DSound("UnitCloak", new Vector3(Position.X(), Y, Position.Y()), 0.25f, 800, 2);

                    fieldState     = FieldState.Cloaked;
                    HasCloaked     = true;
                    CanCloak       = false;
                    FieldStateTime = GetCloakTime();
                }
                else
                {
                    if (attackType != AttackType.White)
                    {
                        SummonUnits();
                    }

                    NoShootTime = MaxNoShootTime;
                    if (attackType == AttackType.White)
                    {
                        ThreatLevel *= 1.5f;
                    }

                    if (!PathFindingManager.CollisionLine(Position.get(), Damager.Position.get()))
                    {
                        AngerTime           = MaxAngerTime;
                        CurrentAttackTarget = Damager;
                    }

                    base.Damage(damage, pushTime, pushSpeed, Damager, attackType);

                    if (HullDamage >= HullToughness && Damager.FactionNumber != NeutralManager.NeutralFaction && ScoreToGive > 0)
                    {
                        if (CanDeathSound)
                        {
                            SoundManager.Play3DSound(DeathSound, new Vector3(Position.X(), Y, Position.Y()), DeathVolume * 0.5f, DeathDistance, DeathExponenent * 2);
                        }

                        ScoreToGive = (int)(ScoreToGive * (0.75f + 0.25f * UnitLevel) * (IsHuge ? 1.25f : 1) *
                                            (HasCloaked || CanCloak ? 1.5f : 1) * (CanSummon || HasSummoned ? 4 : 1));
                        TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), ScoreToGive.ToString(), (byte)Damager.GetTeam());
                        FactionManager.AddScore(Damager.FactionNumber, ScoreToGive);
                        FactionManager.Factions[Damager.FactionNumber].roundReport.UnitKills++;
                        ScoreToGive = 0;
                    }
                }
            }
        }
Example #7
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
#if EDITOR && WINDOWS
            if (ParentLevel.LevelForEditing)
            {
                DrawScene(DrawCamera);
            }
            else
#endif
            {
                bloomRenderer.Draw(FinalTarget, distortionRenderer.distortionMap);
                Render.ViewIndex = 0;
                foreach (WorldViewer3D s in WorldViewerChildren)
                {
                    Render.ViewIndex++;
                    Render.CurrentWorldViewer3D = s;
                    s.getSceneView().Set();
                    Render.CurrentView = s.getSceneView();
                    CurrentCamera      = s.getCamera();

                    if (s.GetType().Equals(typeof(PlayerShip)))
                    {
                        DrawingShip = (PlayerShip)s;
                    }

                    HudDisplaceWidthParam.SetValue(s.getSceneView().Size.X);
                    if (DrawingShip != null && DrawingShip.ShakeOffset.Length() > 0.1f)
                    {
                        HudDisplaceDisplacmentParam.SetValue(Math.Abs(DrawingShip.ShakeOffset.Length() * 10));
                    }
                    else
                    {
                        HudDisplaceDisplacmentParam.SetValue(0);
                    }


                    Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicWrap, DepthStencilState.None, RasterizerState.CullNone, HudDisplaceEffect);

                    if (s.GetType().Equals(typeof(PlayerShip)))
                    {
                        PlayerShip p = (PlayerShip)s;
                        TextParticleSystem.Draw(CurrentCamera);
                    }
                    foreach (GameObject o in Draw2DChildren)
                    {
                        o.Draw2D(GameObjectTag._2DForward);
                    }

                    foreach (GameObject o in OverDrawChildren2D)
                    {
                        o.Draw2D(GameObjectTag._2DOverDraw);
                    }

                    Game1.spriteBatch.End();
                }

                MasterManager.SetViewportToFullscreen();

                Game1.spriteBatch.Begin();
                foreach (GameObject o in OverDrawViewsChildren)
                {
                    o.Draw2D(GameObjectTag.OverDrawViews);
                }
                Game1.spriteBatch.End();
            }
        }