Ejemplo n.º 1
0
 public override void Update()
 {
     base.Update();
     if (!this.destroyed && !this._stuck)
     {
         if (!this.burning && Level.CheckCircle <SmallFire>(this.position, 8f) != null)
         {
             this.burning = true;
             this.onFire  = true;
             Level.Add((Thing)SmallFire.New(0.0f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)this), firedFrom: ((Thing)this)));
             SFX.Play("ignite", Rando.Float(0.9f, 1f), Rando.Float(-0.2f, 0.2f));
         }
         this._sprite.frame = 0;
         this.angleDegrees  = -Maths.PointDirection(Vec2.Zero, new Vec2(this.hSpeed, this.vSpeed));
     }
     if (this._stuck)
     {
         this.vSpeed         = 0.0f;
         this.hSpeed         = 0.0f;
         this.grounded       = true;
         this._sprite.frame  = 1;
         this._stickTime    -= 0.01f;
         this.gravMultiplier = 0.0f;
     }
     if ((double)this._stickTime > 0.0 || this.destroyed)
     {
         return;
     }
     this.Destroy((DestroyType) new DTFade());
 }
Ejemplo n.º 2
0
 protected override bool OnDestroy(DestroyType type = null)
 {
     if (this.isServerForObject)
     {
         for (int index = 0; index < this._numFlames; ++index)
         {
             Level.Add((Thing)SmallFire.New(this.x - this.hSpeed, this.y - this.vSpeed, Rando.Float(6f) - 3f, Rando.Float(6f) - 3f, firedFrom: ((Thing)this)));
         }
     }
     SFX.Play("flameExplode", 0.9f, Rando.Float(0.2f) - 0.1f);
     Level.Remove((Thing)this);
     return(true);
 }
Ejemplo n.º 3
0
 public override void OnPressAction()
 {
     if (this.ammo > 0)
     {
         if (this.owner is Duck owner)
         {
             --this.ammo;
             SFX.Play("lightMatch", 0.5f, Rando.Float(0.2f) - 0.4f);
             float num1 = 0.0f;
             float num2 = 0.0f;
             if (owner.inputProfile.Down("LEFT"))
             {
                 --num1;
             }
             if (owner.inputProfile.Down("RIGHT"))
             {
                 ++num1;
             }
             if (owner.inputProfile.Down("UP"))
             {
                 --num2;
             }
             if (owner.inputProfile.Down("DOWN"))
             {
                 ++num2;
             }
             if (this.receivingPress || !this.isServerForObject)
             {
                 return;
             }
             if (owner.crouch)
             {
                 Level.Add((Thing)SmallFire.New(this.x + (float)this.offDir * 11f, this.y, 0.0f, 0.0f, firedFrom: ((Thing)this)));
             }
             else
             {
                 Level.Add((Thing)SmallFire.New(this.x + (float)this.offDir * 11f, this.y, (float)this.offDir * (1f + Rando.Float(0.3f)) + num1, -0.6f - Rando.Float(0.5f) + num2, firedFrom: ((Thing)this)));
             }
         }
         else
         {
             this.OnBurn(this.position, (Thing)this);
         }
     }
     else
     {
         this.DoAmmoClick();
     }
 }
Ejemplo n.º 4
0
 public override void OnPressAction()
 {
     if ((double)this.heat > 1.0)
     {
         for (int index = 0; index < this.ammo / 10 + 3; ++index)
         {
             Level.Add((Thing)SmallFire.New(this.x - 6f + Rando.Float(12f), this.y - 8f + Rando.Float(4f), Rando.Float(6f) - 3f, 1f - Rando.Float(4.5f), firedFrom: ((Thing)this)));
         }
         SFX.Play("explode", pitch: (Rando.Float(0.3f) - 0.3f));
         Level.Remove((Thing)this);
         this._sound.Kill();
         Level.Add((Thing) new ExplosionPart(this.x, this.y));
     }
     this._firing = true;
 }
Ejemplo n.º 5
0
 protected override bool OnBurn(Vec2 firePosition, Thing litBy)
 {
     if (this.ammo > 0)
     {
         for (int index = 0; index < 5; ++index)
         {
             Level.Add((Thing)SmallFire.New(this.x - 6f + Rando.Float(12f), this.y - 8f + Rando.Float(4f), Rando.Float(4f) - 2f, (float)-(1.0 + (double)Rando.Float(2f)), firedFrom: ((Thing)this)));
         }
         SFX.Play("ignite", pitch: (Rando.Float(0.3f) - 0.3f));
         if (this.owner is Duck owner)
         {
             owner.ThrowItem();
         }
         this.ammo = 0;
     }
     return(true);
 }
Ejemplo n.º 6
0
 public override void UpdateOnFire()
 {
     if (!this.onFire)
     {
         return;
     }
     this._burnWait -= 0.01f;
     if ((double)this._burnWait < 0.0)
     {
         Level.Add((Thing)SmallFire.New(10f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)this), canMultiply: false, firedFrom: ((Thing)this)));
         this._burnWait = 1f;
     }
     if ((double)this.burnt >= 1.0)
     {
         return;
     }
     this.burnt += 1f / 1000f;
 }
Ejemplo n.º 7
0
 public override void Update()
 {
     base.Update();
     if (this.ammo == 0)
     {
         this._firing            = false;
         this._barrelFlame.speed = 0.0f;
     }
     if (this._firing && this._barrelFlame.currentAnimation == "idle")
     {
         this._barrelFlame.SetAnimation("puff");
     }
     if (this._firing && this._barrelFlame.currentAnimation == "puff" && this._barrelFlame.finished)
     {
         this._barrelFlame.SetAnimation("flame");
     }
     if (!this._firing && this._barrelFlame.currentAnimation != "idle")
     {
         this._barrelFlame.SetAnimation("puffOut");
     }
     if (this._barrelFlame.currentAnimation == "puffOut" && this._barrelFlame.finished)
     {
         this._barrelFlame.SetAnimation("idle");
     }
     this._sound.lerpVolume = this._firing ? 0.5f : 0.0f;
     if (this.isServerForObject && this._firing && this._barrelFlame.imageIndex > 5)
     {
         this._flameWait -= 0.25f;
         if ((double)this._flameWait > 0.0)
         {
             return;
         }
         Vec2 vec  = Maths.AngleToVec(this.barrelAngle + Rando.Float(-0.5f, 0.5f));
         Vec2 vec2 = new Vec2(vec.x * Rando.Float(2f, 3.5f), vec.y * Rando.Float(2f, 3.5f));
         this.ammo -= 2;
         Level.Add((Thing)SmallFire.New(this.barrelPosition.x, this.barrelPosition.y, vec2.x, vec2.y, firedFrom: ((Thing)this)));
         this._flameWait = 1f;
     }
     else
     {
         this._flameWait = 0.0f;
     }
 }
Ejemplo n.º 8
0
 public override void OnPressAction()
 {
     if (this.ammo > 0)
     {
         if ((double)this._burnLife <= 0.0)
         {
             SFX.Play("dartStick", 0.5f, Rando.Float(0.2f) - 0.1f);
         }
         else
         {
             --this.ammo;
             SFX.Play("dartGunFire", 0.5f, Rando.Float(0.2f) - 0.1f);
             this.kick = 1f;
             if (this.receivingPress || !this.isServerForObject)
             {
                 return;
             }
             Vec2  vec2    = this.Offset(this.barrelOffset);
             float radians = this.barrelAngle + Rando.Float(-0.1f, 0.1f);
             Dart  dart    = new Dart(vec2.x, vec2.y, this.owner as Duck, -radians);
             this.Fondle((Thing)dart);
             if (this.onFire)
             {
                 Level.Add((Thing)SmallFire.New(0.0f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)dart), firedFrom: ((Thing)this)));
                 dart.burning = true;
                 dart.onFire  = true;
             }
             Vec2 vec = Maths.AngleToVec(radians);
             dart.hSpeed = vec.x * 10f;
             dart.vSpeed = vec.y * 10f;
             Level.Add((Thing)dart);
         }
     }
     else
     {
         this.DoAmmoClick();
     }
 }
Ejemplo n.º 9
0
 public override void Update()
 {
     if (this._car == null && !(Level.current is Editor) && this.isServerForObject)
     {
         this._car = new RCCar(this.x, this.y);
         Level.Add((Thing)this._car);
     }
     ++this._inc;
     if (this._inc > 14 && this._car != null)
     {
         this._inc = 0;
         if (this._car.receivingSignal && !this._car.destroyed)
         {
             Level.Add((Thing) new RCControlBolt(this.x, this.y, this._car));
         }
     }
     if (this.isServerForObject)
     {
         if (this._burning && (double)this._burnLife > 0.0)
         {
             this._burnWait -= 0.01f;
             if ((double)this._burnWait < 0.0)
             {
                 Level.Add((Thing)SmallFire.New(8f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)this), canMultiply: false, firedFrom: ((Thing)this)));
                 this._burnWait = 1f;
             }
             this._burnLife -= 1f / 500f;
             if ((double)this._burnLife <= 0.0)
             {
                 this._sprite.frame = 1;
             }
         }
         if (this.owner is Duck owner)
         {
             if (this._pressed && this._car != null)
             {
                 if (this._car.owner == null)
                 {
                     this.Fondle((Thing)this._car);
                 }
                 this._car.moveLeft  = owner.inputProfile.Down("LEFT");
                 this._car.moveRight = owner.inputProfile.Down("RIGHT");
                 this._car.jump      = owner.inputProfile.Pressed("JUMP");
                 if (owner.inputProfile.Pressed("GRAB"))
                 {
                     this.Fondle((Thing)this._car);
                     this._car.Destroy();
                 }
             }
             else
             {
                 this._car.moveLeft = this._car.moveRight = this._car.jump = false;
             }
         }
         if (this._car != null && this._car.destroyed)
         {
             this.ammo = 0;
         }
     }
     base.Update();
 }
Ejemplo n.º 10
0
 public override void OnHit(bool destroyed, Bullet b)
 {
     Level.Add(SmallFire.New(b.x, b.y, 0, 0));
     base.OnHit(destroyed, b);
 }
Ejemplo n.º 11
0
        public static int DestroyBlocksRadius(Vec2 pPosition, float pRadius, Thing culprit, bool pExplode = false, bool destroyWindows = true, bool destroyPhyObjs = true, bool explodeMakeFire = false)
        {
            if (destroyWindows)
            {
                foreach (Window w in Level.CheckCircleAll <Window>(pPosition, pRadius - 20f))
                {
                    Thing.Fondle(w, DuckNetwork.localConnection);
                    if (Level.CheckLine <Block>(pPosition, w.position, w) == null)
                    {
                        w.Destroy(new DTImpact(culprit));
                    }
                }
            }
            if (destroyPhyObjs)
            {
                foreach (PhysicsObject p in Level.CheckCircleAll <PhysicsObject>(pPosition, pRadius + 30f))
                {
                    if (p == culprit)
                    {
                        continue;
                    }
                    if (culprit.isLocal && culprit.owner == null)
                    {
                        Thing.Fondle(p, DuckNetwork.localConnection);
                    }
                    if ((p.position - pPosition).length < 30f)
                    {
                        p.Destroy(new DTImpact(culprit));
                    }
                    p.sleeping = false;
                    p.vSpeed   = -2f;
                }
            }
            int idd = 0;
            HashSet <ushort> idx = new HashSet <ushort>();

            foreach (BlockGroup block2 in Level.CheckCircleAll <BlockGroup>(pPosition, pRadius))
            {
                if (block2 == null)
                {
                    continue;
                }
                BlockGroup group = block2;
                foreach (Block bl in group.blocks)
                {
                    if (!Collision.Circle(pPosition, pRadius - 22f, bl.rectangle))
                    {
                        continue;
                    }
                    bl.shouldWreck = true;
                    if (bl is AutoBlock {
                        indestructable: false
                    } block)
                    {
                        idx.Add(block.blockIndex);
                        if (pExplode && idd % 10 == 0)
                        {
                            Level.Add(new ExplosionPart(block.x, block.y));
                            if (explodeMakeFire)
                            {
                                Level.Add(SmallFire.New(block.x, block.y, Rando.Float(-2f, 2f), Rando.Float(-2f, 2f)));
                            }
                        }
                        idd++;
                    }
                }
                group.Wreck();
            }
            foreach (Block block in Level.CheckCircleAll <Block>(pPosition, pRadius - 22f))
            {
                if (block is AutoBlock {
                    indestructable: false
                } autoBlock)
                {
                    autoBlock.skipWreck   = true;
                    autoBlock.shouldWreck = true;
                    idx.Add(autoBlock.blockIndex);
                    if (pExplode)
                    {
                        if (idd % 10 == 0 && explodeMakeFire)
                        {
                            Level.Add(new ExplosionPart(autoBlock.x, autoBlock.y));
                            Level.Add(SmallFire.New(autoBlock.x, autoBlock.y, Rando.Float(-2f, 2f), Rando.Float(-2f, 2f)));
                        }
                        idd++;
                    }
                }