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"); }
public override void Draw() { float num1 = this.distOut + (float)Math.Sin((double)this.sizeWaver) * 2f; float distOut = this.distOut; this._thickness = 2f; for (int index = 0; index < 4; ++index) { float deg = this.rot + (float)index * 90f; Vec2 vec2 = new Vec2((float)Math.Cos((double)Maths.DegToRad(deg)), (float)-Math.Sin((double)Maths.DegToRad(deg))); Graphics.DrawLine(this.position + vec2 * distOut, this.position + vec2 * (distOut + this.distLen), this._color * this.alpha, this._thickness, new Depth(0.9f)); Graphics.DrawLine(this.position + vec2 * (distOut - 1f), this.position + vec2 * (distOut + 1f + this.distLen), Color.Black, this._thickness + 2f, new Depth(0.8f)); } if ((double)this.streamAlpha <= 0.00999999977648258) { return; } int num2 = 0; Vec2 vec2_1 = Vec2.Zero; bool flag = false; foreach (Vec2 prevPo in this.prevPos) { if (flag) { Vec2 normalized = (vec2_1 - prevPo).normalized; Graphics.DrawLine(vec2_1 - normalized, prevPo + normalized, this._color * this.streamAlpha, (float)(4.0 + (double)num2 * 2.0), new Depth(0.9f)); } vec2_1 = prevPo; flag = true; ++num2; } }
public override void Update() { if (this._fade) { this.enablePhysics = false; } base.Update(); this._startWait -= 0.1f; this.angle = -Maths.DegToRad(Maths.PointDirection(this.x, this.y, this._prevPosition.x, this._prevPosition.y)); this._isVolatile -= 0.06f; for (int index = 15; index >= 0; --index) { this._trail[index + 1] = new Vec2(this._trail[index].x, this._trail[index].y); } if (!this._fade) { this._trail[0] = new Vec2(this.x, this.y); ++this._numTrail; } else { --this._numTrail; this._fadeVal -= 0.1f; if ((double)this._fadeVal <= 0.0) { Level.Remove((Thing)this); } } this._prevPosition.x = this.position.x; this._prevPosition.y = this.position.y; }
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)); } }
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"); }
public override void UpdateSkeleton() { int num = 6; int frame = 0; if (this.sliding) { frame = 12; } else if (this.crouch) { frame = 11; } this._skeleton.head.position = this.Offset(DuckRig.GetHatPoint(frame) + new Vec2(0.0f, (float)-num)); this._skeleton.upperTorso.position = this.Offset(DuckRig.GetChestPoint(frame) + new Vec2(0.0f, (float)-num)); this._skeleton.lowerTorso.position = this.position + new Vec2(0.0f, (float)(10 - num)); if (this.sliding) { this._skeleton.head.orientation = Maths.DegToRad(90f); this._skeleton.upperTorso.orientation = Maths.DegToRad(90f); } else { this._skeleton.head.orientation = 0.0f; this._skeleton.upperTorso.orientation = 0.0f; } }
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); }
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"); }
// Token: 0x0600254F RID: 9551 protected bool OnDestroybam(DestroyType type = null) { if (!base.isServerForObject) { return(false); } ATRCShrapnel shrap = new ATRCShrapnel(); shrap.MakeNetEffect(this.position, false); List <Bullet> firedBullets = new List <Bullet>(); for (int i = 0; i < 20; i++) { float dir = (float)i * 18f - 5f + Rando.Float(10f); shrap = new ATRCShrapnel(); shrap.range = 55f + Rando.Float(14f); Bullet bullet = new Bullet(base.x + (float)(Math.Cos((double)Maths.DegToRad(dir)) * 6.0), base.y - (float)(Math.Sin((double)Maths.DegToRad(dir)) * 6.0), shrap, dir, null, false, -1f, false, true); bullet.firedFrom = this; firedBullets.Add(bullet); Level.Add(bullet); } if (Network.isActive) { Send.Message(new NMFireGun(null, firedBullets, 0, false, 4, false), NetMessagePriority.ReliableOrdered, null); firedBullets.Clear(); } Level.Remove(this); return(true); }
public override void DrawHoverInfo() { string text = "EMPTY"; if (this.contains != (System.Type)null) { text = this.contains.Name; } Graphics.DrawString(text, this.position + new Vec2((float)(-(double)Graphics.GetStringWidth(text) / 2.0), -16f), Color.White, new Depth(0.9f)); if (!(this.contains != (System.Type)null)) { return; } if (this._hoverThing == null || this._hoverThing.GetType() != this.contains) { this._hoverThing = Editor.CreateThing(this.contains) as PhysicsObject; } if (this._hoverThing == null) { return; } Vec2 vec2 = Maths.AngleToVec(Maths.DegToRad(this.direction)) * this.firePower; this._hoverThing.position = this.position + vec2.normalized * 8f; this._hoverThing.hSpeed = vec2.x; this._hoverThing.vSpeed = vec2.y; Vec2 position = this._hoverThing.position; for (int index = 0; index < 100; ++index) { this._hoverThing.UpdatePhysics(); Graphics.DrawLine(position, this._hoverThing.position, Color.Red, 2f, new Depth(1f)); position = this._hoverThing.position; } }
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 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); } }
public override void Draw() { float num1 = 22f; float num2 = 0.0f; float num3 = 13f; Vec2 vec2_1 = Vec2.Zero; Vec2 vec2_2 = Vec2.Zero; bool flag1 = false; bool flag2 = false; Vec2 t1 = new Vec2(0.0f, 0.0f); Vec2 t2 = new Vec2(1f, 0.0f); Vec2 t3 = new Vec2(0.0f, 1f); Vec2 t4 = new Vec2(1f, 1f); if (this._capeTexture == null) { return; } float depth = DuckGame.Graphics.AdjustDepth(this.depth); for (int index = this.capePeices.Count - 1; index >= 0; --index) { TrailPiece capePeice = this.capePeices[index]; Vec2 vec2_3 = vec2_2; if (index > 0) { Vec2 vec2_4 = capePeice.p1 - this.capePeices[index - 1].p1; vec2_4.Normalize(); vec2_3 = vec2_4.Rotate(Maths.DegToRad(90f), Vec2.Zero); } Vec2 vec2_5 = capePeice.p1; if (flag1) { Vec2 vec2_4 = vec2_5 - vec2_1; float length = vec2_4.length; num2 += length; vec2_4.Normalize(); if ((double)num2 > (double)num1) { vec2_5 = vec2_1 + vec2_4 * (length - (num2 - num1)); flag2 = true; } DuckGame.Graphics.screen.DrawQuad(vec2_5 - vec2_3 * (float)((double)num3 * (double)capePeice.wide / 2.0), vec2_5 + vec2_3 * (float)((double)num3 * (double)capePeice.wide / 2.0), vec2_1 - vec2_2 * (float)((double)num3 * (double)capePeice.wide / 2.0), vec2_1 + vec2_2 * (float)((double)num3 * (double)capePeice.wide / 2.0), t1, t2, t3, t4, depth, this._capeTexture, Color.White); if (flag2) { break; } } flag1 = true; vec2_1 = vec2_5; vec2_2 = vec2_3; } }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (this._fade || with is Gun || (with is AutoPlatform || with is Nubber) && (double)this.vSpeed <= 0.0) { return; } if (with is PhysicsObject) { this._isVolatile = -1f; } if ((double)this._startWait <= 0.0 && !this._fade && ((double)this.totalImpactPower > 2.0 && ((double)this._isVolatile <= 0.0 || !(with is Block)) || this._blowUp)) { int num1 = 0; for (int index = 0; index < 1; ++index) { ExplosionPart explosionPart = new ExplosionPart(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f)); explosionPart.xscale *= 0.7f; explosionPart.yscale *= 0.7f; Level.Add((Thing)explosionPart); ++num1; } SFX.Play("explode"); for (int index = 0; index < 12; ++index) { float num2 = (float)((double)index * 30.0 - 10.0) + Rando.Float(20f); ATShrapnel atShrapnel = new ATShrapnel(); atShrapnel.range = 25f + Rando.Float(10f); Level.Add((Thing) new Bullet(this.x + (float)(Math.Cos((double)Maths.DegToRad(num2)) * 8.0), this.y - (float)(Math.Sin((double)Maths.DegToRad(num2)) * 8.0), (AmmoType)atShrapnel, num2) { firedFrom = (Thing)this }); } this._fade = true; this.y += 10000f; } else { if (with is IPlatform) { return; } if (from == ImpactedFrom.Left || from == ImpactedFrom.Right) { this.BounceH(); } if (from != ImpactedFrom.Top && from != ImpactedFrom.Bottom) { return; } this.BounceV(); } }
public override void Draw() { float num1 = 13f; Vec2 vec2_1 = Vec2.Zero; Vec2 vec2_2 = Vec2.Zero; bool flag1 = false; bool flag2 = false; if (this._capeTexture == null) { return; } float depth = DuckGame.Graphics.AdjustDepth(this.depth); float num2 = 1f / (float)this.capePeices.Count; float val1 = 0.0f; for (int index = this.capePeices.Count - 1; index >= 0; --index) { Vec2 t1 = new Vec2(0.0f, Math.Min(val1 + num2, 1f)); Vec2 t2 = new Vec2(1f, Math.Min(val1 + num2, 1f)); Vec2 t3 = new Vec2(0.0f, Math.Min(val1, 1f)); Vec2 t4 = new Vec2(1f, Math.Min(val1, 1f)); CapePeice capePeice = this.capePeices[index]; Vec2 vec2_3 = vec2_2; if (index > 0) { Vec2 vec2_4 = capePeice.p1 - this.capePeices[index - 1].p1; vec2_4.Normalize(); vec2_3 = vec2_4.Rotate(Maths.DegToRad(90f), Vec2.Zero); } Vec2 vec2_5 = capePeice.p1; if (flag1) { Vec2 vec2_4 = vec2_5 - vec2_1; float length = vec2_4.length; vec2_4.Normalize(); if ((double)length > 2.0) { vec2_5 = vec2_1 + vec2_4 * 2f; } DuckGame.Graphics.screen.DrawQuad(vec2_5 - vec2_3 * (float)((double)num1 * (double)capePeice.wide / 2.0), vec2_5 + vec2_3 * (float)((double)num1 * (double)capePeice.wide / 2.0), vec2_1 - vec2_2 * (float)((double)num1 * (double)capePeice.wide / 2.0), vec2_1 + vec2_2 * (float)((double)num1 * (double)capePeice.wide / 2.0), t1, t2, t3, t4, depth, this._capeTexture, new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, this._trail ? (int)(byte)((double)index / (double)this.capePeices.Count * (double)byte.MaxValue) : (int)byte.MaxValue)); if (flag2) { break; } } flag1 = true; vec2_1 = vec2_5; vec2_2 = vec2_3; val1 += num2; } }
public override void Draw() { if (this.duck != null && !this._raised && (double)this._raiseArm > 0.0) { SpriteMap spriteArms = this.duck._spriteArms; bool flipH = spriteArms.flipH; float angle = spriteArms.angle; spriteArms.flipH = (int)this.offDir * -1 < 0; spriteArms.angle = 0.7f * (float)this.offDir; Graphics.Draw((Sprite)spriteArms, this.owner.x - (float)(5 * (int)this.offDir), (float)((double)this.owner.y + 3.0 + (this.duck.crouch ? 3.0 : 0.0) + (this.duck.sliding ? 3.0 : 0.0))); spriteArms.angle = angle; spriteArms.flipH = flipH; this.handOffset = new Vec2(9999f, 9999f); } else { this.handOffset = new Vec2(1f, 1f); } if (this.owner != null && (double)this._haloAlpha > 0.00999999977648258) { this._halo.alpha = (float)((double)this._haloAlpha * 0.400000005960464 + (double)(float)this._haloWave * 0.100000001490116); this._halo.depth = new Depth(-0.2f); this._halo.xscale = this._halo.yscale = (float)(0.949999988079071 + (double)(float)this._haloWave * 0.0500000007450581); this._halo.angle += 0.01f; Graphics.Draw(this._halo, this.owner.x, this.owner.y); if ((double)this._ringPulse > 0.0) { int num1 = 16; Vec2 vec2_1 = Vec2.Zero; float num2 = (float)((double)this._ammoType.range * 0.100000001490116 + (1.0 - (double)this._ringPulse) * ((double)this._ammoType.range * 0.899999976158142)); for (int index = 0; index < num1; ++index) { float rad = Maths.DegToRad((float)(360 / (num1 - 1) * index)); Vec2 vec2_2 = new Vec2((float)Math.Cos((double)rad) * num2, (float)-Math.Sin((double)rad) * num2); if (index > 0) { Graphics.DrawLine(this.owner.position + vec2_2, this.owner.position + vec2_1, Color.White * (this._ringPulse * 0.6f), this._ringPulse * 10f); } vec2_1 = vec2_2; } } } base.Draw(); }
public static void Draw() { foreach (KeyValuePair <NetworkConnection, ConnectionIndicatorElement> connection in ConnectionIndicator._connections) { if (connection.Value.duck != null && !connection.Value.duck.dead) { int num1 = connection.Value.NumActiveDetails(); if (num1 > 0) { float num2 = 27f; float num3 = (float)(num1 - 1) * num2; Vec2 vec2_1 = new Vec2(-1000f, -1000f); vec2_1 = connection.Value.position + new Vec2(0.0f, 6f); float num4 = (float)num1 / (float)connection.Value.details.Count; int num5 = 0; float num6 = -20f; bool flag = false; Vec2 vec2_2 = Vec2.Zero; foreach (KeyValuePair <ConnectionIndicatorType, ConnectionIndicatorDetail> detail in connection.Value.details) { if (detail.Value.visible) { float deg = (float)(-(double)num3 / 2.0 + (double)num5 * (double)num2); float x = vec2_1.x - (float)Math.Sin((double)Maths.DegToRad(deg)) * num6; float y = vec2_1.y + (float)Math.Cos((double)Maths.DegToRad(deg)) * num6; ConnectionIndicator._lagIcons.depth = new Depth(0.9f); ConnectionIndicator._lagIcons.frame = detail.Value.iconFrame; ConnectionIndicator._lagIcons.scale = new Vec2((float)(1.0 + (1.0 - (double)detail.Value.grow) * 0.300000011920929)); Graphics.Draw((Sprite)ConnectionIndicator._lagIcons, x, y); if (flag) { Vec2 vec2_3 = new Vec2(x, y); Vec2 normalized = (vec2_3 - vec2_2).normalized; Graphics.DrawTexturedLine(ConnectionIndicator._rainbowGradient.texture, vec2_2 - normalized, vec2_3 + normalized, Color.White * num4, (float)(0.600000023841858 + 0.600000023841858 * (double)num4), new Depth(0.85f)); } flag = true; vec2_2 = new Vec2(x, y); ++num5; } } } } } }
public PopEffect(float xpos, float ypos) : base(xpos, ypos) { this._sprite = new SpriteMap("popLine", 16, 16); this.center = new Vec2((float)(this._sprite.w / 2), (float)(this._sprite.h / 2)); this.graphic = (Sprite)this._sprite; int num1 = 8; for (int index = 0; index < num1; ++index) { float num2 = 360f / (float)num1 * (float)index; this.parts.Add(new PopEffect.PopEffectPart() { scale = Rando.Float(0.6f, 1f), rot = Maths.DegToRad(num2 + Rando.Float(-10f, 10f)) }); } this.depth = new Depth(0.9f); }
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 < 3; ++index) { Thing thing; if (index == 1) { thing = (Thing) new FireExtinguisher(c.x, c.y); } else { thing = (Thing) new RomanCandle(c.x, c.y); (thing as Gun).PressAction(); } float num2 = (float)index / 2f; thing.hSpeed = (float)((double)num2 * 30.0 - 15.0) * Rando.Float(0.5f, 1f); thing.vSpeed = Rando.Float(-3f, -11f); Level.Add(thing); } 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 < 8; ++index) { Present present = new Present(c.x, c.y); float num2 = (float)index / 7f; present.hSpeed = (float)((double)num2 * 30.0 - 15.0) * Rando.Float(0.5f, 1f); present.vSpeed = Rando.Float(-3f, -11f); Level.Add((Thing)present); } for (int index = 0; index < 4; ++index) { Flower flower = new Flower(c.x, c.y); float num2 = (float)index / 3f; flower.hSpeed = (float)((double)num2 * 20.0 - 10.0) * Rando.Float(0.5f, 1f); flower.vSpeed = Rando.Float(-3f, -11f); Level.Add((Thing)flower); } Level.Remove((Thing)c); } Graphics.FlashScreen(); SFX.Play("harp"); }
public static void Draw() { int num1 = 0; foreach (RegisteredVote vote in Vote._votes) { if (vote.vote == VoteType.Skip) { float num2 = (float)(Math.Sin((double)vote.wobbleInc) * (double)vote.wobble * 3.0); Vec2 vec2 = Network.isActive ? vote.leftStick : vote.who.inputProfile.leftStick; vote.who.persona.skipSprite.angle = (float)((double)num2 * 0.0299999993294477 + (double)vec2.y * 0.400000005960464); vote.who.persona.skipSprite.frame = 0; Graphics.Draw((Sprite)vote.who.persona.skipSprite, (float)((double)Layer.HUD.width + 49.0 - (double)vote.slide * 48.0 + (double)vec2.x * 3.0), (float)((double)Layer.HUD.height - 28.0 - (double)(num1 * 16) - (double)vec2.y * 3.0), new Depth(0.9f)); vote.who.persona.skipSprite.frame = 1; Vec2 p2 = Network.isActive ? vote.rightStick : vote.who.inputProfile.rightStick; vote.who.persona.skipSprite.angle = num2 * 0.03f + Maths.DegToRad(Maths.PointDirection(Vec2.Zero, p2) - 180f); Graphics.Draw((Sprite)vote.who.persona.skipSprite, (float)((double)Layer.HUD.width + 68.0 - (double)vote.slide * 48.0 + (double)p2.x * 20.0), (float)((double)Layer.HUD.height - 32.0 - (double)(num1 * 16) - (double)p2.y * 20.0), new Depth(0.9f)); } ++num1; } }
// Token: 0x06001988 RID: 6536 protected override bool OnDestroy(DestroyType type = null) { if (!base.isServerForObject) { return(false); } ATRCShrapnel atrcshrapnel = new ATRCShrapnel(); atrcshrapnel.MakeNetEffect(this.position, false); List <Bullet> list = new List <Bullet>(); for (int i = 0; i < 20; i++) { float num = (float)i * 18f - 5f + Rando.Float(10f); atrcshrapnel = new ATRCShrapnel(); atrcshrapnel.range = 55f + Rando.Float(14f); Bullet bullet = new Bullet(base.x + (float)(Math.Cos((double)Maths.DegToRad(num)) * 6.0), base.y - (float)(Math.Sin((double)Maths.DegToRad(num)) * 6.0), atrcshrapnel, num, null, false, -1f, false, true); bullet.firedFrom = this; list.Add(bullet); Level.Add(bullet); } if (Network.isActive) { Send.Message(new NMFireGun(null, list, 0, false, 4, false), NetMessagePriority.ReliableOrdered, null); list.Clear(); } Level.Remove(this); FollowCam followCam = Level.current.camera as FollowCam; if (followCam != null) { followCam.Remove(this); } if (Recorder.currentRecording != null) { Recorder.currentRecording.LogBonus(); } return(true); }
public void Spawn() { if (this.randomSpawn) { List <System.Type> physicsObjects = ItemBox.GetPhysicsObjects(Editor.Placeables); this.contains = physicsObjects[Rando.Int(physicsObjects.Count - 1)]; } this._spawnWait = 0.0f; ++this._numSpawned; if (!(Editor.CreateThing(this.contains) is PhysicsObject thing)) { return; } Vec2 vec2 = Maths.AngleToVec(Maths.DegToRad(this.direction)) * this.firePower; thing.position = this.position + vec2.normalized * 8f; thing.hSpeed = vec2.x; thing.vSpeed = vec2.y; Level.Add((Thing)thing); Level.Add((Thing)SmallSmoke.New(thing.x, thing.y)); Level.Add((Thing)SmallSmoke.New(thing.x, thing.y)); SFX.Play("netGunFire", Rando.Float(0.9f, 1f), Rando.Float(-0.1f, 0.1f)); if (thing is Equipment) { (thing as Equipment).autoEquipTime = 0.5f; } if (thing is ChokeCollar) { (thing as ChokeCollar).ball.hSpeed = thing.hSpeed; (thing as ChokeCollar).ball.vSpeed = thing.vSpeed; } if (!(thing is Sword)) { return; } (thing as Sword)._wasLifted = true; (thing as Sword)._framesExisting = 16; }
public override void Update() { if (Level.current.simulatePhysics) { this._spawnWait += 0.0166666f; } if (Level.current.simulatePhysics && Network.isServer && (this._numSpawned < this.spawnNum || this.spawnNum == -1) && (double)this._spawnWait >= (double)this.spawnTime) { if ((double)this.initialDelay > 0.0) { this.initialDelay -= 0.0166666f; } else { Vec2 travel = Maths.AngleToVec(Maths.DegToRad(this.direction)) * this.firePower; Vec2 vec2 = this.position - travel.normalized * 16f; Level.Add((Thing) new QuadLaserBullet(vec2.x, vec2.y, travel)); this._spawnWait = 0.0f; ++this._numSpawned; } } this.angleDegrees = -this.direction; }
public override void Draw() { this._move = Lerp.Float(this._move, 0.0f, 0.04f); if ((double)this._move <= 0.00999999977648258) { this._move += 1.570796f; } if ((double)this._length > (double)this.dist) { this.show = false; } this._alphaFade = Lerp.Float(this._alphaFade, this.show ? 1f : 0.0f, 0.1f); this._length = this._startLength * (float)Math.Sin((double)this._move); this.alpha = (float)(1.0 - (double)this._length / (double)this._startLength) * this._alphaFade; if ((double)this.alpha < 0.00999999977648258) { return; } this.position = this._attach.barrelPosition + this._attach.barrelVector * this._length; Vec2 vec2 = this._attach.barrelVector.Rotate(Maths.DegToRad(90f), Vec2.Zero); Graphics.DrawLine(this.position + vec2 * 7f, this.position - vec2 * 7f, Color.Blue * this.alpha, (float)(1.0 + (1.0 - (double)this._length / (double)this._startLength) * 4.0), new Depth(0.9f)); }
public override void OnHit(bool destroyed, Bullet b) { if (!b.isLocal) { return; } if (destroyed) { new ATMissileShrapnel().MakeNetEffect(b.position, false); Random random = (Random)null; if (Network.isActive && b.isLocal) { random = Rando.generator; Rando.generator = new Random(NetRand.currentSeed); } List <Bullet> varBullets = new List <Bullet>(); for (int index = 0; index < 12; ++index) { float num = (float)((double)index * 30.0 - 10.0) + Rando.Float(20f); ATMissileShrapnel atMissileShrapnel = new ATMissileShrapnel(); atMissileShrapnel.range = 15f + Rando.Float(5f); Vec2 vec2 = new Vec2((float)Math.Cos((double)Maths.DegToRad(num)), (float)Math.Sin((double)Maths.DegToRad(num))); Bullet bullet = new Bullet(b.x + vec2.x * 8f, b.y - vec2.y * 8f, (AmmoType)atMissileShrapnel, num); bullet.firedFrom = (Thing)b; varBullets.Add(bullet); Level.Add((Thing)bullet); Level.Add((Thing)Spark.New(b.x + Rando.Float(-8f, 8f), b.y + Rando.Float(-8f, 8f), vec2 + new Vec2(Rando.Float(-0.1f, 0.1f), Rando.Float(-0.1f, 0.1f)))); Level.Add((Thing)SmallSmoke.New(b.x + vec2.x * 8f + Rando.Float(-8f, 8f), b.y + vec2.y * 8f + Rando.Float(-8f, 8f))); } if (Network.isActive && b.isLocal) { Send.Message((NetMessage) new NMFireGun((Gun)null, varBullets, (byte)0, false), NetMessagePriority.ReliableOrdered); varBullets.Clear(); } if (Network.isActive && b.isLocal) { Rando.generator = random; } foreach (Window window in Level.CheckCircleAll <Window>(b.position, 30f)) { if (b.isLocal) { Thing.Fondle((Thing)window, DuckNetwork.localConnection); } if (Level.CheckLine <Block>(b.position, window.position, (Thing)window) == null) { window.Destroy((DestroyType) new DTImpact((Thing)b)); } } foreach (PhysicsObject physicsObject in Level.CheckCircleAll <PhysicsObject>(b.position, 70f)) { if (b.isLocal && b.owner == null) { Thing.Fondle((Thing)physicsObject, DuckNetwork.localConnection); } if ((double)(physicsObject.position - b.position).length < 30.0) { physicsObject.Destroy((DestroyType) new DTImpact((Thing)b)); } physicsObject.sleeping = false; physicsObject.vSpeed = -2f; } HashSet <ushort> varBlocks = new HashSet <ushort>(); foreach (BlockGroup blockGroup1 in Level.CheckCircleAll <BlockGroup>(b.position, 50f)) { if (blockGroup1 != null) { BlockGroup blockGroup2 = blockGroup1; List <Block> blockList = new List <Block>(); foreach (Block block in blockGroup2.blocks) { if (Collision.Circle(b.position, 28f, block.rectangle)) { block.shouldWreck = true; if (block is AutoBlock) { varBlocks.Add((block as AutoBlock).blockIndex); } } } blockGroup2.Wreck(); } } foreach (Block block in Level.CheckCircleAll <Block>(b.position, 28f)) { switch (block) { case AutoBlock _: block.skipWreck = true; block.shouldWreck = true; if (block is AutoBlock) { varBlocks.Add((block as AutoBlock).blockIndex); continue; } continue; case Door _: case VerticalDoor _: Level.Remove((Thing)block); block.Destroy((DestroyType) new DTRocketExplosion((Thing)null)); continue; default: continue; } } if (Network.isActive && b.isLocal && varBlocks.Count > 0) { Send.Message((NetMessage) new NMDestroyBlocks(varBlocks)); } } base.OnHit(destroyed, b); }
public override void Update() { base.Update(); if (!this._pin) { this._timer -= 0.01f; } if ((double)this._timer < 0.5 && this.owner == null && !this._didBonus) { this._didBonus = true; if (Recorder.currentRecording != null) { Recorder.currentRecording.LogBonus(); } } if (!this._localDidExplode && (double)this._timer < 0.0) { if (this._explodeFrames < 0) { this.CreateExplosion(this.position); this._explodeFrames = 4; } else { --this._explodeFrames; if (this._explodeFrames == 0) { float x = this.x; float num1 = this.y - 2f; Graphics.FlashScreen(); if (this.isServerForObject) { for (int index = 0; index < 20; ++index) { float num2 = (float)((double)index * 18.0 - 5.0) + Rando.Float(10f); ATShrapnel atShrapnel = new ATShrapnel(); atShrapnel.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)atShrapnel, num2); bullet.firedFrom = (Thing)this; this.firedBullets.Add(bullet); Level.Add((Thing)bullet); } 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)); } } this.bulletFireIndex += (byte)20; if (Network.isActive) { Send.Message((NetMessage) new NMFireGun((Gun)this, this.firedBullets, this.bulletFireIndex, false), NetMessagePriority.ReliableOrdered); this.firedBullets.Clear(); } } Level.Remove((Thing)this); this._destroyed = true; this._explodeFrames = -1; } } } if (this.prevOwner != null && this._cookThrower == null) { this._cookThrower = this.prevOwner as Duck; this._cookTimeOnThrow = this._timer; } this._sprite.frame = this._pin ? 0 : 1; }
public override void Draw(bool transparent, bool isTargetDraw = false) { DuckGame.Graphics.currentLayer = (Layer)this; this._effect.World = (Microsoft.Xna.Framework.Matrix)Matrix.CreateTranslation(new Vec3(190f, -75f, 300f)); this.Begin(transparent, false); this._planet.flipH = true; DuckGame.Graphics.Draw(this._planet, 0.0f, 0.0f); this._batch.End(); this._effect.World = (Microsoft.Xna.Framework.Matrix)(Matrix.CreateRotationX(Maths.DegToRad(90f)) * Matrix.CreateTranslation(new Vec3(-400f, 52f, 0.0f))); this.Begin(transparent, false); float num1 = 32f; int num2 = 26; int num3 = 16; for (int index = 0; index < num3; ++index) { DuckGame.Graphics.DrawLine(new Vec2(0.0f + this._scroll, (float)index * num1), new Vec2(num1 * (float)(num2 - 1), (float)index * num1), Color.DarkGray, 3f); } for (int index = 0; index < num2; ++index) { DuckGame.Graphics.DrawLine(new Vec2((float)index * num1 + this._scroll, 0.0f), new Vec2((float)index * num1 + this._scroll, num1 * (float)(num3 - 1)), Color.DarkGray, 3f); } this._batch.End(); this._effect.World = (Microsoft.Xna.Framework.Matrix)(Matrix.CreateRotationX(Maths.DegToRad(90f)) * Matrix.CreateTranslation(new Vec3(-400f, 62f, 0.0f))); this.Begin(transparent, false); for (int index = 0; index < num3; ++index) { DuckGame.Graphics.DrawLine(new Vec2(0.0f + this._scroll, (float)index * num1), new Vec2(num1 * (float)(num2 - 1), (float)index * num1), Color.DarkGray * 0.2f, 3f); } for (int index = 0; index < num2; ++index) { DuckGame.Graphics.DrawLine(new Vec2((float)index * num1 + this._scroll, 0.0f), new Vec2((float)index * num1 + this._scroll, num1 * (float)(num3 - 1)), Color.DarkGray * 0.2f, 3f); } this._batch.End(); this._effect.World = (Microsoft.Xna.Framework.Matrix)(Matrix.CreateRotationX(Maths.DegToRad(90f)) * Matrix.CreateTranslation(new Vec3(-400f, -52f, 0.0f))); this.Begin(transparent, false); for (int index = 0; index < num3; ++index) { DuckGame.Graphics.DrawLine(new Vec2(0.0f + this._scroll, (float)index * num1), new Vec2(num1 * (float)(num2 - 1), (float)index * num1), Color.DarkGray, 3f); } for (int index = 0; index < num2; ++index) { DuckGame.Graphics.DrawLine(new Vec2((float)index * num1 + this._scroll, 0.0f), new Vec2((float)index * num1 + this._scroll, num1 * (float)(num3 - 1)), Color.DarkGray, 3f); } this._batch.End(); DuckGame.Graphics.screen = (MTSpriteBatch)null; DuckGame.Graphics.currentLayer = (Layer)null; }
public override void PostDrawLayer(Layer layer) { if (NetworkDebugger._instances.Count == 0) { return; } if (layer == Layer.Console) { if (NetworkDebugger._interfaces[0].pin || (double)Mouse.xConsole < (double)Layer.Console.width / 2.0 && (double)Mouse.yConsole < (double)Layer.Console.height / 2.0) { DevConsoleCore core = DevConsole.core; DevConsole.core = NetworkDebugger._instances[0].consoleCore; NetworkDebugger._interfaces[0].Draw(NetworkDebugger._instances[0].network); DevConsole.core = core; } else { NetworkDebugger._interfaces[0].visible = false; } if (NetworkDebugger._interfaces[1].pin || (double)Mouse.xConsole > (double)Layer.Console.width / 2.0 && (double)Mouse.yConsole < (double)Layer.Console.height / 2.0) { if (NetworkDebugger._instances.Count > 1) { DevConsoleCore core = DevConsole.core; DevConsole.core = NetworkDebugger._instances[1].consoleCore; NetworkDebugger._interfaces[1].Draw(NetworkDebugger._instances[1].network); DevConsole.core = core; } } else { NetworkDebugger._interfaces[1].visible = false; } if (NetworkDebugger._interfaces[2].pin || (double)Mouse.xConsole <(double)Layer.Console.width / 2.0 && (double)Mouse.yConsole> (double) Layer.Console.height / 2.0) { if (NetworkDebugger._instances.Count > 2) { DevConsoleCore core = DevConsole.core; DevConsole.core = NetworkDebugger._instances[2].consoleCore; NetworkDebugger._interfaces[2].Draw(NetworkDebugger._instances[2].network); DevConsole.core = core; } } else { NetworkDebugger._interfaces[2].visible = false; } if (NetworkDebugger._interfaces[3].pin || (double)Mouse.xConsole > (double)Layer.Console.width / 2.0 && (double)Mouse.yConsole > (double)Layer.Console.height / 2.0) { if (NetworkDebugger._instances.Count > 3) { DevConsoleCore core = DevConsole.core; DevConsole.core = NetworkDebugger._instances[3].consoleCore; NetworkDebugger._interfaces[3].Draw(NetworkDebugger._instances[3].network); DevConsole.core = core; } } else { NetworkDebugger._interfaces[3].visible = false; } if (this._connectionArrow == null) { this._connectionArrow = new SpriteMap("connectionArrow", 56, 13); this._connectionArrow.CenterOrigin(); this._connectionX = new Sprite("connectionX"); this._connectionX.CenterOrigin(); } for (int i = 0; i < 4; ++i) { if (NetworkDebugger._instances.Count > i && NetworkDebugger._instances[i].active) { for (int j = 0; j < 4; ++j) { if (i != j && NetworkDebugger._instances.Count > j && NetworkDebugger._instances[j].active) { NetworkConnection networkConnection1 = NetworkDebugger._instances[i].network.core.connections.FirstOrDefault <NetworkConnection>((Func <NetworkConnection, bool>)(x => x.identifier == NetworkDebugger.GetID(j))); NetworkConnection networkConnection2 = NetworkDebugger._instances[j].network.core.connections.FirstOrDefault <NetworkConnection>((Func <NetworkConnection, bool>)(x => x.identifier == NetworkDebugger.GetID(i))); Vec2 vec2_1 = NetworkDebugger._interfaces[i].position + new Vec2((float)(DuckGame.Graphics.width / 4 - 10), (float)(DuckGame.Graphics.height / 4 - 10)); Vec2 vec2_2 = NetworkDebugger._interfaces[j].position + new Vec2((float)(DuckGame.Graphics.width / 4 - 10), (float)(DuckGame.Graphics.height / 4 - 10)); Vec2 p2 = vec2_2 - vec2_1; Vec2 vec2_3 = p2.normalized.Rotate(Maths.DegToRad(90f), Vec2.Zero); float num1 = -Maths.PointDirection(Vec2.Zero, p2); float num2 = 0.0f; if (networkConnection1 != null) { float num3 = 0.0f; float num4 = 0.0f; if (networkConnection2 != null) { num3 = NetworkDebugger.GetReceived(networkConnection1.identifier, networkConnection2.identifier); num4 = NetworkDebugger.GetSent(networkConnection1.identifier, networkConnection2.identifier); num2 = 6f; } this._connectionArrow.frame = networkConnection1.status != ConnectionStatus.Connected ? 0 : 3; this._connectionArrow.angleDegrees = num1; this._connectionArrow.alpha = 1f; this._connectionArrow.depth = new Depth(0.92f); Vec2 vec2_4 = (vec2_1 + vec2_2) / 2f + vec2_3 * num2; DuckGame.Graphics.Draw((Sprite)this._connectionArrow, vec2_4.x, vec2_4.y); if (networkConnection1.status != ConnectionStatus.Disconnecting) { this._connectionX.depth = new Depth(0.98f); Vec2 vec2_5 = vec2_4 - p2.normalized * 22f; if ((double)(Mouse.positionConsole - vec2_5).length < 8.0) { this._connectionX.alpha = 1f; if (this.lefpres) { networkConnection1.Disconnect(); SFX.Play("quack"); } } else { this._connectionX.alpha = 0.4f; } DuckGame.Graphics.Draw(this._connectionX, vec2_5.x, vec2_5.y); } if ((double)num4 > 0.0) { ++this._connectionArrow.frame; this._connectionArrow.alpha = num4; this._connectionArrow.depth = new Depth(0.95f); DuckGame.Graphics.Draw((Sprite)this._connectionArrow, vec2_4.x, vec2_4.y); --this._connectionArrow.frame; } if ((double)num3 > 0.0) { this._connectionArrow.frame += 2; this._connectionArrow.alpha = num3; this._connectionArrow.depth = new Depth(0.95f); DuckGame.Graphics.Draw((Sprite)this._connectionArrow, vec2_4.x, vec2_4.y); this._connectionArrow.frame -= 2; } } } } } } } base.PostDrawLayer(layer); }