コード例 #1
0
 public void Initialize(IntoTheBlaze game)
 {
     this.game             = game;
     menu                  = game.MenuScreen;
     level                 = game.LevelScreen;
     tinyFire              = new List <BigFlameParticle>();
     mouseOnContinueButton = false;
 }
コード例 #2
0
 public void Update(GameTime time, HeatMap heatMap, GamePartSystem partSystem, LevelScreen levelScreen)
 {
     if (IsDestroyed)
     {
         return;
     }
     if (Type.Type == ObjectType.Hydrant)
     {
         return;
     }
     if (IsBurning)
     {
         Burning = Math.Min(Burning + 0.5f, Type.FireLimit);
         heatMap.RadiateHeat(Position, Burning);
         HP -= Burning / 1000f;
         if (IsDestroyed)
         {
             if (Type.Type == ObjectType.Explosive)
             {
                 heatMap.Explode(Position);
                 partSystem.Explode(Position);
                 levelScreen.ExplosionSound.Play(1f, 0f, Position.X / 512f - 1f);
                 levelScreen.ExplosionSound.Play(1f, 0f, Position.X / 512f - 1f);
                 levelScreen.ExplosionSound.Play(1f, 0f, Position.X / 512f - 1f);
             }
         }
         else
         {
             var count = (int)(Burning / 100f) + 1;
             if (FireArea is Circle c)
             {
                 for (var i = 0; i < count; ++i)
                 {
                     var d = MathHelper.ToRadians(Utils.Random.Next(360));
                     var l = Utils.Random.Next(c.Radius);
                     partSystem.AddFirePart(
                         new Vector2(
                             Position.X + c.X + (float)Math.Cos(d) * l,
                             Position.Y + c.Y - (float)Math.Sin(d) * l
                             ),
                         Type.FireType
                         );
                 }
             }
             else if (FireArea is Rect r)
             {
                 for (var i = 0; i < count; ++i)
                 {
                     partSystem.AddFirePart(
                         new Vector2(
                             Position.X + r.X - r.Width / 2 + Utils.Random.Next(r.Width),
                             Position.Y + r.Y - r.Height / 2 + Utils.Random.Next(r.Height)
                             ),
                         Type.FireType
                         );
                 }
             }
         }
     }
 }