Esempio n. 1
0
 public static void BurnIfTouchingSomethingHot <T>(T me, TimeSpan?burnTime = null, char?symbol = null, bool disposeOnBurn = false) where T : SpacialElement
 {
     burnTime = burnTime.HasValue ? burnTime.Value : TimeSpan.FromSeconds(3);
     if (SpaceTime.CurrentSpaceTime.Elements.Where(e => e.HasSimpleTag("hot") && e.CalculateDistanceTo(me) < 2).Any())
     {
         if (SpaceTime.CurrentSpaceTime.Elements.WhereAs <Fire>().Where(f => f.Left == me.Left && f.Top == me.Top).Count() == 0)
         {
             var fire = new Fire(burnTime.Value)
             {
                 SymbolOverride = symbol
             };
             fire.MoveTo(me.Left, me.Top, me.ZIndex + 1);
             fire.ResizeTo(me.Width, me.Height);
             SpaceTime.CurrentSpaceTime.Add(fire);
             if (disposeOnBurn)
             {
                 me.Lifetime.Dispose();
             }
         }
     }
 }
Esempio n. 2
0
 private void Evaluate()
 {
     if (Time.CurrentTime.Now - initialTime > TimeSpan.FromSeconds(5))
     {
         foreach (var matter in Composite)
         {
             matter.Lifetime.Dispose();
         }
     }
     else
     {
         Fire.BurnIfTouchingSomethingHot(this);
         var distance = this.CalculateDistanceTo(initialBonds);
         if (distance > 10)
         {
             foreach (var matter in Composite)
             {
                 matter.Speed.Stop();
             }
         }
     }
 }
Esempio n. 3
0
 public override void Evaluate()
 {
     Fire.BurnIfTouchingSomethingHot(this, TimeSpan.FromSeconds(.1), this.Symbol.Value);
 }
Esempio n. 4
0
 private void Evaluate()
 {
     Fire.BurnIfTouchingSomethingHot(this, TimeSpan.FromSeconds(4), this.Symbol.Value, true);
 }