public void PauseLogic()
 {
     if (Input.Pressed("START"))
     {
         this._pauseGroup.Open();
         this._pauseMenu.Open();
         MonoMain.pauseMenu = this._pauseGroup;
         if (this._paused)
         {
             return;
         }
         SFX.Play("pause", 0.6f);
         this._paused = true;
     }
     else
     {
         if (!this._paused || MonoMain.pauseMenu != null)
         {
             return;
         }
         this._paused = false;
         SFX.Play("resume", 0.6f);
         DeathmatchLevel._started = false;
     }
 }
Esempio n. 2
0
 public override void Update()
 {
     this._ammoSprite.frame = this._ammoMax - this.ammo;
     base.Update();
     if (this._readyToShoot)
     {
         this._loadProgress = 1f;
         this._loadWait     = 0.0f;
     }
     if ((double)this._loadWait > 0.0)
     {
         return;
     }
     if ((double)this._loadProgress == 0.0)
     {
         SFX.Play("shotgunLoad");
     }
     if ((double)this._loadProgress == 0.5)
     {
         this.Reload();
     }
     this._loadWait = 0.0f;
     if ((double)this._loadProgress < 1.0)
     {
         this._loadProgress += 0.1f;
     }
     else
     {
         this._loadProgress = 1f;
         this._readyToShoot = true;
         this._readyToShoot = false;
     }
 }
Esempio n. 3
0
 public void Degrapple()
 {
     this._harpoon.Return();
     if (this._rope != null)
     {
         this._rope.RemoveRope();
     }
     if (this._rope != null && this.duck != null)
     {
         this.duck.frictionMult   = 1f;
         this.duck.gravMultiplier = 1f;
         this.duck._double        = false;
         if ((double)this.duck.vSpeed < 0.0 && this.duck.framesSinceJump > 3)
         {
             this.duck.vSpeed *= 1.75f;
         }
         if ((double)this.duck.vSpeed >= (double)this.duck.jumpSpeed * 0.949999988079071 && (double)Math.Abs(this.duck.vSpeed) + (double)Math.Abs(this.duck.hSpeed) < 2.0)
         {
             SFX.Play("jump", 0.5f);
             this.duck.vSpeed = this.duck.jumpSpeed;
         }
     }
     this._rope          = (Rope)null;
     this.frictionMult   = 1f;
     this.gravMultiplier = 1f;
 }
Esempio n. 4
0
        public void CreateExplosion(Vec2 pos)
        {
            if (this._explosionCreated)
            {
                return;
            }
            float x    = pos.x;
            float ypos = pos.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            this._explosionCreated = true;
            SFX.Play("explode");
        }
        public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 10; ++index)
                {
                    Mine  mine = new Mine(c.x, c.y);
                    float num2 = (float)index / 9f;
                    mine.hSpeed = (float)((double)num2 * 40.0 - 20.0) * Rando.Float(0.5f, 1f);
                    mine.vSpeed = Rando.Float(-3f, -11f);
                    mine.PressAction();
                    mine.Arm();
                    Level.Add((Thing)mine);
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
Esempio n. 6
0
 // Token: 0x06002238 RID: 8760
 public override void OnReleaseAction()
 {
     if (this._chargeAnim.currentAnimation == "charge")
     {
         if (this._chargeAnim.frame > 20)
         {
             this._unchargeSound.Volume = 1f;
             this._unchargeSound.Play();
         }
         else
         {
             this._unchargeSoundShort.Volume = 1f;
             this._unchargeSoundShort.Play();
         }
         int index = this._chargeAnim.frame;
         this._chargeAnim.SetAnimation("uncharge");
         this._chargeAnim.frame = 22 - index;
         this._chargeSound.Stop();
         this._chargeSound.Volume = 0f;
         this._chargeSoundShort.Stop();
         this._chargeSoundShort.Volume = 0f;
     }
     if (this._chargeAnim.currentAnimation == "charged")
     {
         Graphics.FlashScreen();
         this._chargeAnim.SetAnimation("drain");
         SFX.Play("laserBlast", 1f, 0f, 0f, false);
         for (int i = 0; i < 4; i++)
         {
             Level.Add(new ElectricalCharge(base.barrelPosition.x, base.barrelPosition.y, (int)this.offDir, this));
         }
     }
 }
Esempio n. 7
0
 public override void OnPressAction()
 {
     if (this.ammo > 0)
     {
         --this.ammo;
         SFX.Play("netGunFire");
         this._barrelSteam.speed = 1f;
         this._barrelSteam.frame = 0;
         this.ApplyKick();
         Vec2 vec2 = this.Offset(this.barrelOffset);
         if (this.receivingPress)
         {
             return;
         }
         Net net = new Net(vec2.x, vec2.y - 2f, this.duck);
         Level.Add((Thing)net);
         this.Fondle((Thing)net);
         if (this.owner != null)
         {
             net.responsibleProfile = this.owner.responsibleProfile;
         }
         net.clip.Add(this.owner as MaterialThing);
         net.hSpeed = this.barrelVector.x * 10f;
         net.vSpeed = (float)((double)this.barrelVector.y * 7.0 - 1.5);
     }
     else
     {
         this.DoAmmoClick();
     }
 }
Esempio n. 8
0
        protected override bool OnDestroy(DestroyType type = null)
        {
            this._hitPoints = 0.0f;
            Level.Remove((Thing)this);
            SFX.Play("glassHit");
            Vec2 hitAngle = Vec2.Zero;

            if (type is DTShot)
            {
                hitAngle = (type as DTShot).bullet.travelDirNormalized;
            }
            for (int index = 0; index < 8; ++index)
            {
                Thing thing = (Thing) new GlassParticle(this.x + Rando.Float(-4f, 4f), this.y + Rando.Float(-4f, 4f), hitAngle);
                Level.Add(thing);
                thing.hSpeed = (float)((double)hitAngle.x * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929));
                thing.vSpeed = (float)((double)hitAngle.y * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929)) - Rando.Float(2f);
                Level.Add(thing);
            }
            for (int index = 0; index < 5; ++index)
            {
                SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-6f, 6f), this.y + Rando.Float(-6f, 6f));
                smallSmoke.hSpeed += Rando.Float(-0.3f, 0.3f);
                smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                Level.Add((Thing)smallSmoke);
            }
            return(true);
        }
Esempio n. 9
0
 public override bool Hit(Bullet bullet, Vec2 hitPos)
 {
     if ((double)this._hitPoints <= 0.0)
     {
         return(base.Hit(bullet, hitPos));
     }
     for (int index = 0; (double)index < 1.0 + (double)this.damageMultiplier / 2.0; ++index)
     {
         Thing thing = (Thing)WoodDebris.New(hitPos.x, hitPos.y);
         thing.hSpeed = (float)(-(double)bullet.travelDirNormalized.x * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929));
         thing.vSpeed = (float)(-(double)bullet.travelDirNormalized.y * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929)) - Rando.Float(2f);
         Level.Add(thing);
     }
     SFX.Play("woodHit");
     if (bullet.isLocal)
     {
         this._hitPoints       -= this.damageMultiplier;
         this.damageMultiplier += 2f;
         if ((double)this._hitPoints <= 0.0)
         {
             this.Destroy((DestroyType) new DTShot(bullet));
         }
     }
     return(base.Hit(bullet, hitPos));
 }
Esempio n. 10
0
        public static void Update()
        {
            XInputPad device = Input.GetDevice <XInputPad>();

            if ((double)Shredder._noteWait <= 0.0)
            {
                if (device.MapDown(16384, false))
                {
                    Shredder._currentNote = Shredder.GetNextNote(Shredder._currentNote, Shredder._basicScale);
                    SFX.Play("guitar/guitar-" + Change.ToString((object)Shredder._currentNote));
                    Shredder._noteWait = 1f;
                }
                if (device.MapDown(32768, false))
                {
                    Shredder._currentNote = Shredder._currentNote = (int)Shredder._basicScale[0];
                    SFX.Play("guitar/guitar-" + Change.ToString((object)Shredder._currentNote));
                    Shredder._noteWait = 1f;
                }
                if (device.MapDown(8192, false))
                {
                    Shredder._currentNote = Shredder.GetPrevNote(Shredder._currentNote, Shredder._basicScale);
                    SFX.Play("guitar/guitar-" + Change.ToString((object)Shredder._currentNote));
                    Shredder._noteWait = 1f;
                }
            }
            Shredder._noteWait -= 0.15f;
        }
 public override void Update()
 {
     if (this.activated && this._sprite.currentAnimation != "activate")
     {
         this._sprite.SetAnimation("activate");
     }
     if (this._sprite.imageIndex == 6 && this._beeps == (byte)0)
     {
         SFX.Play("singleBeep");
         ++this._beeps;
     }
     if (this._sprite.imageIndex == 7 && this._beeps == (byte)1)
     {
         SFX.Play("singleBeep");
         ++this._beeps;
     }
     if (this._sprite.imageIndex == 8 && this._beeps == (byte)2)
     {
         SFX.Play("singleBeep");
         ++this._beeps;
     }
     if (this._sprite.imageIndex == 5 && this._beeps == (byte)3)
     {
         SFX.Play("doubleBeep", pitch: 0.2f);
         ++this._beeps;
     }
     if (this.isServerForObject && this._sprite.currentAnimation == "activate" && (this._sprite.finished && !this._didActivation))
     {
         this._didActivation = true;
         this.setting.Activate(this);
         Send.Message((NetMessage) new NMActivateDeathCrate(this.settingIndex, this));
     }
     base.Update();
 }
Esempio n. 12
0
 public override void Selected()
 {
     SFX.Play("highClick", 0.3f);
     if (Level.current is Editor)
     {
         if (this._field == null)
         {
             return;
         }
         if (this._field.value is IList)
         {
             IList list = this._field.value as IList;
             if (list.Contains((object)this._myType))
             {
                 list.Remove((object)this._myType);
             }
             else
             {
                 list.Add((object)this._myType);
             }
         }
         else
         {
             this._field.value = (object)!(bool)this._field.value;
         }
     }
     else
     {
         if (this._owner == null)
         {
             return;
         }
         this._owner.Selected((ContextMenu)this);
     }
 }
Esempio n. 13
0
        public void MakeBlowUpHappen(Vec2 pos)
        {
            if (this.blownUp)
            {
                return;
            }
            this.blownUp = true;
            SFX.Play("explode");
            Graphics.FlashScreen();
            float x = pos.x;
            float y = pos.y;

            Level.Add((Thing) new ExplosionPart(x, y));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, y - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
        }
Esempio n. 14
0
        public void TakeDuck(Duck d)
        {
            if (this._ducks.Any <BeamDuck>((Func <BeamDuck, bool>)(t => t.duck == d)))
            {
                return;
            }
            float num = (double)d.y >= 100.0 ? 130f : 40f;

            SFX.Play("stepInBeam");
            d.beammode    = true;
            d.immobilized = true;
            d.crouch      = false;
            d.sliding     = false;
            if (d.holdObject != null)
            {
                this._guns.Add((Thing)d.holdObject);
            }
            d.ThrowItem();
            d.solid    = false;
            d.grounded = false;
            d.offDir   = (sbyte)1;
            this._ducks.Add(new BeamDuck()
            {
                duck        = d,
                entryHeight = num,
                leaving     = false,
                entryDir    = (double)d.x < (double)this.x ? -1 : 1,
                sin         = new SinWave(0.1f),
                sin2        = new SinWave(0.05f)
            });
        }
        public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 18; ++index)
                {
                    float  deg  = (float)index * 22.5f;
                    double num2 = (double)Rando.Float(8f, 14f);
                    Level.Add((Thing) new QuadLaserBullet(c.x, c.y, new Vec2((float)Math.Cos((double)Maths.DegToRad(deg)), (float)-Math.Sin((double)Maths.DegToRad(deg)))));
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
Esempio n. 16
0
        protected override bool OnDestroy(DestroyType type = null)
        {
            this._hitPoints = 0.0f;
            Level.Remove((Thing)this);
            SFX.Play("crateDestroy");
            Vec2 vec2 = Vec2.Zero;

            if (type is DTShot)
            {
                vec2 = (type as DTShot).bullet.travelDirNormalized;
            }
            for (int index = 0; index < 6; ++index)
            {
                Thing thing = (Thing)WoodDebris.New(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f));
                thing.hSpeed = (float)(((double)Rando.Float(1f) > 0.5 ? 1.0 : -1.0) * (double)Rando.Float(3f) + (double)Math.Sign(vec2.x) * 0.5);
                thing.vSpeed = -Rando.Float(1f);
                Level.Add(thing);
            }
            for (int index = 0; index < 5; ++index)
            {
                SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-6f, 6f), this.y + Rando.Float(-6f, 6f));
                smallSmoke.hSpeed += Rando.Float(-0.3f, 0.3f);
                smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                Level.Add((Thing)smallSmoke);
            }
            return(true);
        }
Esempio n. 17
0
        public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 8; ++index)
                {
                    Sword sword = new Sword(c.x, c.y);
                    float num2  = (float)index / 7f;
                    sword.hSpeed          = (float)((double)num2 * 30.0 - 15.0) * Rando.Float(0.5f, 1f);
                    sword.vSpeed          = Rando.Float(-10f, 10f);
                    sword._wasLifted      = true;
                    sword._framesExisting = 16;
                    Level.Add((Thing)sword);
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
        public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 16; ++index)
                {
                    Level.Add((Thing)SmallFire.New(c.x - 6f + Rando.Float(12f), c.y - 8f + Rando.Float(4f), Rando.Float(12f) - 6f, 2f - Rando.Float(8.5f), firedFrom: ((Thing)c)));
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
Esempio n. 19
0
 public override bool Hit(Bullet bullet, Vec2 hitPos)
 {
     if ((double)this._hitPoints <= 0.0)
     {
         return(false);
     }
     if (bullet.isLocal && this.owner == null)
     {
         Thing.Fondle((Thing)this, DuckNetwork.localConnection);
     }
     for (int index = 0; (double)index < 1.0 + (double)this.damageMultiplier / 2.0; ++index)
     {
         Level.Add((Thing) new GlassParticle(hitPos.x, hitPos.y, bullet.travelDirNormalized));
     }
     SFX.Play("woodHit");
     if (bullet.isLocal)
     {
         this._hitPoints       -= this.damageMultiplier;
         this.damageMultiplier += 2f;
         if (TeamSelect2.Enabled("EXPLODEYCRATES"))
         {
             if (this.duck != null)
             {
                 this.duck.ThrowItem();
             }
             this.Destroy((DestroyType) new DTShot(bullet));
             Level.Add((Thing) new GrenadeExplosion(this.x, this.y));
         }
         if ((double)this._hitPoints <= 0.0)
         {
             this.Destroy((DestroyType) new DTShot(bullet));
         }
     }
     return(base.Hit(bullet, hitPos));
 }
 public void Update()
 {
     foreach (RecorderSoundItem sound in this.sounds)
     {
         SFX.Play(sound.sound, sound.volume, sound.pitch, sound.pan);
     }
 }
 public override bool Hit(Bullet bullet, Vec2 hitPos)
 {
     if ((double)this._hitPoints <= 0.0)
     {
         return(false);
     }
     hitPos += bullet.travelDirNormalized * 2f;
     if (1.0 - ((double)hitPos.y - (double)this.top) / ((double)this.bottom - (double)this.top) < (double)this._fluidLevel)
     {
         this.thickness = 2f;
         Vec2 off  = hitPos - this.position;
         bool flag = false;
         foreach (FluidStream hole in this._holes)
         {
             if ((double)(hole.offset - off).length < 2.0)
             {
                 hole.offset         = off;
                 hole.holeThickness += 0.5f;
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             this._holes.Add(new FluidStream(0.0f, 0.0f, (-bullet.travelDirNormalized).Rotate(Rando.Float(-0.2f, 0.2f), Vec2.Zero), 1f, off));
         }
         SFX.Play("bulletHitWater", pitch: Rando.Float(-0.2f, 0.2f));
         return(base.Hit(bullet, hitPos));
     }
     this.thickness = 1f;
     return(base.Hit(bullet, hitPos));
 }
Esempio n. 22
0
 public override void Update()
 {
     base.Update();
     this._life        = 1f;
     this.angleDegrees = this._spinAngle;
     if ((bool)this._sparkTimer)
     {
         Level.Add((Thing)Spark.New(this.x, this.y - 2f, new Vec2(Rando.Float(-1f, 1f), -0.5f), 0.1f));
     }
     if (!(bool)this._explodeTimer)
     {
         return;
     }
     SFX.Play("littleGun", Rando.Float(0.8f, 1f), Rando.Float(-0.5f, 0.5f));
     for (int index = 0; index < 8; ++index)
     {
         float      num        = (float)((double)index * 45.0 - 5.0) + Rando.Float(10f);
         ATShrapnel atShrapnel = new ATShrapnel();
         atShrapnel.range = 8f + Rando.Float(3f);
         Level.Add((Thing) new Bullet(this.x + (float)(Math.Cos((double)Maths.DegToRad(num)) * 6.0), this.y - (float)(Math.Sin((double)Maths.DegToRad(num)) * 6.0), (AmmoType)atShrapnel, num)
         {
             firedFrom = (Thing)this
         });
     }
     Level.Add((Thing)SmallSmoke.New(this.x, this.y));
     if ((double)Rando.Float(1f) < 0.100000001490116)
     {
         Level.Add((Thing)SmallFire.New(this.x, this.y, 0.0f, 0.0f, firedFrom: ((Thing)this)));
     }
     Level.Remove((Thing)this);
 }
Esempio n. 23
0
 public static void TickSound(float pos)
 {
     if ((double)pos < (double)RhythmMode._soundPos)
     {
         SFX.Play("metronome");
     }
     RhythmMode._soundPos = pos;
 }
 public override void Update()
 {
     if (this._explodeFrames < 0)
     {
         float x    = this.x;
         float ypos = this.y - 2f;
         Level.Add((Thing) new ExplosionPart(x, ypos));
         int num1 = 6;
         if (Graphics.effectsLevel < 2)
         {
             num1 = 3;
         }
         for (int index = 0; index < num1; ++index)
         {
             float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
             float num2 = Rando.Float(12f, 20f);
             Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
         }
         this._explodeFrames = 4;
     }
     else
     {
         --this._explodeFrames;
         if (this._explodeFrames != 0)
         {
             return;
         }
         float         x          = this.x;
         float         num1       = this.y - 2f;
         List <Bullet> varBullets = new List <Bullet>();
         for (int index = 0; index < 20; ++index)
         {
             float           num2            = (float)((double)index * 18.0 - 5.0) + Rando.Float(10f);
             ATPropExplosion atPropExplosion = new ATPropExplosion();
             atPropExplosion.range = 60f + Rando.Float(18f);
             Bullet bullet = new Bullet(x + (float)(Math.Cos((double)Maths.DegToRad(num2)) * 6.0), num1 - (float)(Math.Sin((double)Maths.DegToRad(num2)) * 6.0), (AmmoType)atPropExplosion, num2);
             bullet.firedFrom = (Thing)this;
             varBullets.Add(bullet);
             Level.Add((Thing)bullet);
         }
         if (Network.isActive)
         {
             Send.Message((NetMessage) new NMExplodingProp(varBullets), NetMessagePriority.ReliableOrdered);
             varBullets.Clear();
         }
         Graphics.flashAdd = 1.3f;
         Layer.Game.darken = 1.3f;
         foreach (Window window in Level.CheckCircleAll <Window>(this.position, 40f))
         {
             if (Level.CheckLine <Block>(this.position, window.position, (Thing)window) == null)
             {
                 window.Destroy((DestroyType) new DTImpact((Thing)this));
             }
         }
         SFX.Play("explode");
         Level.Remove((Thing)this);
     }
 }
Esempio n. 25
0
        public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
        {
            if (from == ImpactedFrom.Bottom && (double)this.hitWait == 0.0 && with.isServerForObject)
            {
                with.Fondle((Thing)this);
            }
            if (!this.isServerForObject || from != ImpactedFrom.Bottom || (double)this.hitWait != 0.0)
            {
                return;
            }
            this.hitWait = 1f;
            switch (with)
            {
            case Holdable holdable when holdable.lastThrownBy != null || holdable is RagdollPart && !Network.isActive:
                Duck lastThrownBy = holdable.lastThrownBy as Duck;
                if (holdable is RagdollPart)
                {
                    break;
                }
                if (lastThrownBy != null)
                {
                    PurpleBlock.StoreItem(lastThrownBy.profile, (Thing)with);
                }
                this.Bounce();
                break;

            case Duck duck:
                StoredItem storedItem = PurpleBlock.GetStoredItem(duck.profile);
                if (storedItem.type != (System.Type)null && !this._served.Contains(duck.profile))
                {
                    this.contains      = storedItem.type;
                    this._contextThing = storedItem.thing;
                    this.Pop();
                    this._hit = false;
                    this._served.Add(duck.profile);
                }
                else
                {
                    if (this._served.Contains(duck.profile))
                    {
                        SFX.Play("scanFail");
                    }
                    this.Bounce();
                }
                if (duck.holdObject == null)
                {
                    break;
                }
                Holdable holdObject = duck.holdObject;
                if (holdObject == null)
                {
                    break;
                }
                PurpleBlock.StoreItem(duck.profile, (Thing)holdObject);
                break;
            }
        }
Esempio n. 26
0
 protected override bool OnBurn(Vec2 firePosition, Thing litBy)
 {
     if (!this.onFire)
     {
         SFX.Play("ignite", pitch: (Rando.Float(0.3f) - 0.3f));
     }
     this.onFire = true;
     return(true);
 }
Esempio n. 27
0
        public static void StoreItem(Profile p, Thing t)
        {
            if (Network.isActive && t is RagdollPart || t is TrappedDuck)
            {
                return;
            }
            if (t is WeightBall)
            {
                t = (Thing)(t as WeightBall).collar;
            }
            StoredItem storedItem = PurpleBlock.GetStoredItem(p);

            System.Type type = t.GetType();
            if (!(storedItem.type != type) && !(storedItem.type == typeof(RagdollPart)) && (!(t is TeamHat) || !(storedItem.thing is TeamHat) || (t as TeamHat).team == (storedItem.thing as TeamHat).team))
            {
                return;
            }
            Thing thing;

            if (t is RagdollPart)
            {
                if (storedItem.thing != null && storedItem.thing is SpriteThing && (storedItem.thing as SpriteThing).persona == (t as RagdollPart)._persona)
                {
                    return;
                }
                thing = (Thing) new SpriteThing(0.0f, 0.0f, (Sprite)(t as RagdollPart)._persona.defaultHead);
                (thing as SpriteThing).persona = (t as RagdollPart)._persona;
            }
            else
            {
                thing = Editor.CreateThing(type);
            }
            if (thing is TeamHat)
            {
                TeamHat teamHat1 = thing as TeamHat;
                TeamHat teamHat2 = t as TeamHat;
                teamHat1.sprite       = teamHat2.sprite.CloneMap();
                teamHat1.graphic      = (Sprite)teamHat1.sprite;
                teamHat1.pickupSprite = teamHat2.pickupSprite.Clone();
                teamHat1.team         = teamHat2.team;
            }
            else if (thing.graphic == null)
            {
                thing.graphic = t.graphic.Clone();
            }
            storedItem.sprite = thing.GetEditorImage(0, 0, true, (Effect)PurpleBlock._grayscaleEffect);
            storedItem.sprite.CenterOrigin();
            if (t is RagdollPart)
            {
                storedItem.sprite.centerx += 2f;
                storedItem.sprite.centery += 4f;
            }
            storedItem.type  = type;
            storedItem.thing = thing;
            SFX.Play("scanBeep");
        }
Esempio n. 28
0
        protected override void Rebound(Vec2 pos, float dir, float rng)
        {
            GrenadeBullet bullet = this.ammo.GetBullet(pos.x, pos.y, angle: (-dir), firedFrom: this.firedFrom, distance: rng, tracer: this._tracer) as GrenadeBullet;

            bullet._teleporter = this._teleporter;
            bullet._isVolatile = this._isVolatile;
            bullet.isLocal     = this.isLocal;
            Level.Add((Thing)bullet);
            SFX.Play("grenadeBounce", 0.8f, Rando.Float(-0.1f, 0.1f));
        }
Esempio n. 29
0
 public override void OnPressAction()
 {
     if (!this._ruined)
     {
         this.channel       = !this.channel;
         this._switchFrames = 8;
         SFX.Play("switchchannel", 0.7f, 0.5f);
     }
     base.OnPressAction();
 }
Esempio n. 30
0
 public void SpringUp()
 {
     this._sprite.currentAnimation = "spring";
     this._sprite.frame            = 0;
     if ((double)this._soundWait > 0.0)
     {
         return;
     }
     SFX.Play("spring", 0.25f, Rando.Float(0.2f) - 0.1f);
     this._soundWait = 1f;
 }