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 override void Update() { if ((double)Math.Abs(this.hSpeed) + (double)Math.Abs(this.vSpeed) > 0.100000001490116) { this.angleDegrees = -Maths.PointDirection(Vec2.Zero, new Vec2(this.hSpeed, this.vSpeed)); } if (this.grounded && (double)Math.Abs(this.vSpeed) + (double)Math.Abs(this.hSpeed) <= 0.0) { this.alpha -= 0.2f; } if ((double)this.alpha <= 0.0) { Level.Remove((Thing)this); } if (!this.onFire && Level.CheckRect <SmallFire>(this.position + new Vec2(-4f, -4f), this.position + new Vec2(4f, 4f), (Thing)this) != null) { this.onFire = true; Level.Add((Thing)SmallFire.New(0.0f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)this), firedFrom: ((Thing)this))); } base.Update(); }
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; } }
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); }
public override void Update() { if (this.isServerForObject) { this.xscale = this.yscale = Maths.CountUp(this.yscale, 0.05f); this._fade -= 0.05f; if ((double)this._fade < 0.0) { Level.Remove((Thing)this); } this.alpha = Maths.NormalizeSection(this._fade, 0.2f, 0.3f); Vec2 p2 = Vec2.Zero; if (this._owner.controlledDuck == null && !this._isNotControlRay) { p2 = new Vec2((float)Math.Cos((double)this.angle), (float)-Math.Sin((double)this.angle)); foreach (IAmADuck amAduck in Level.CheckCircleAll <IAmADuck>(this.position, 3f)) { switch (amAduck) { case Duck _: if (!(amAduck as Duck).HasEquipment(typeof(TinfoilHat)) && !((amAduck as Duck).holdObject is MindControlRay)) { this._owner.ControlDuck(amAduck as Duck); continue; } continue; case RagdollPart _ when(amAduck as RagdollPart).doll.captureDuck != null: this._owner.ControlDuck((amAduck as RagdollPart).doll.captureDuck); continue; case TrappedDuck _ when(amAduck as TrappedDuck).captureDuck != null: this._owner.ControlDuck((amAduck as TrappedDuck).captureDuck); continue; default: continue; } } } else { if (this._owner.controlledDuck != null) { p2 = this._owner.controlledDuck.cameraPosition - this.position; p2.Normalize(); this.angleDegrees = -Maths.PointDirection(Vec2.Zero, p2); } this._isNotControlRay = true; } ControlWave controlWave = this; controlWave.position = controlWave.position + p2 * 2.6f; } else { this.xscale = this.yscale = 1f; Vec2 vec2 = new Vec2((float)Math.Cos((double)this.angle), (float)-Math.Sin((double)this.angle)); ControlWave controlWave = this; controlWave.position = controlWave.position + vec2 * 2.6f; } }
public override void Update() { if (this._harpoon == null) { return; } if (this.isServerForObject) { this.ropeData.Clear(); this.SerializeRope(this._rope); } else { this.ropeData.SeekToStart(); this.DeserializeRope(this._rope); } if (this._rope != null) { this._rope.SetServer(this.isServerForObject); } if (this.isServerForObject && this._equippedDuck != null && this.duck != null) { if (this.duck._trapped != null) { this.Degrapple(); } ATTracer atTracer = new ATTracer(); float num = atTracer.range = this._grappleLength; atTracer.penetration = 1f; float ang = 45f; if (this.offDir < (sbyte)0) { ang = 135f; } if (this._harpoon.inGun) { Vec2 p1 = this.Offset(this.barrelOffset); if (this._lagFrames > 0) { --this._lagFrames; if (this._lagFrames == 0) { this._canGrab = false; } else { ang = Maths.PointDirection(p1, this._lastHit); } } atTracer.penetration = 9f; Bullet bullet = new Bullet(p1.x, p1.y, (AmmoType)atTracer, ang, this.owner, tracer: true); this._wallPoint = bullet.end; this._grappleTravel = bullet.travelDirNormalized; num = (p1 - this._wallPoint).length; } if ((double)num < (double)this._grappleLength - 2.0 && (double)num <= (double)this._grappleDist + 16.0) { this._lastHit = this._wallPoint; this._canGrab = true; } else if (this._canGrab && this._lagFrames == 0) { this._lagFrames = 6; this._wallPoint = this._lastHit; } else { this._canGrab = false; } this._grappleDist = num; if (this.duck.inputProfile.Pressed("JUMP") && this.duck._trapped == null) { if (this._harpoon.inGun) { if (!this.duck.grounded && this.duck.framesSinceJump > 6 && this._canGrab && (!(this.duck.holdObject is TV) || (this.duck.holdObject as TV)._ruined || (!(this.duck.holdObject as TV).channel || !this.duck._double) || this.duck._groundValid <= 0)) { this._harpoon.Fire(this.wallPoint, this.grappelTravel); this._rope = new Rope(this.barrelPosition.x, this.barrelPosition.y, (Thing)null, (Thing)this._harpoon, (Thing)this.duck, tex: this._ropeSprite, belongsTo: ((Thing)this)); Level.Add((Thing)this._rope); } } else { this.Degrapple(); this._lagFrames = 0; this._canGrab = false; } } } base.Update(); if (this.owner != null) { this.offDir = this.owner.offDir; } if (this.duck != null) { this.duck.grappleMul = false; } if (!this.isServerForObject || this._rope == null) { return; } if (this.owner != null) { this._rope.position = this.owner.position; } else { this._rope.position = this.position; if (this.prevOwner != null) { PhysicsObject prevOwner = this.prevOwner as PhysicsObject; prevOwner.frictionMult = 1f; prevOwner.gravMultiplier = 1f; this._prevOwner = (Thing)null; this.frictionMult = 1f; this.gravMultiplier = 1f; if (this.prevOwner is Duck) { (this.prevOwner as Duck).grappleMul = false; } } } if (!this._harpoon.stuck) { return; } if (this.duck != null) { if (!this.duck.grounded) { this.duck.frictionMult = 0.0f; } else { this.duck.frictionMult = 1f; this.duck.gravMultiplier = 1f; } if ((double)this._rope.properLength > 0.0) { if (this.duck.inputProfile.Down("UP") && (double)this._rope.properLength >= 16.0) { this._rope.properLength -= 2f; } if (this.duck.inputProfile.Down("DOWN") && (double)this._rope.properLength <= 256.0) { this._rope.properLength += 2f; } this._rope.properLength = Maths.Clamp(this._rope.properLength, 16f, 256f); } } else if (!this.grounded) { this.frictionMult = 0.0f; } else { this.frictionMult = 1f; this.gravMultiplier = 1f; } Vec2 vec2_1 = this._rope.attach1.position - this._rope.attach2.position; if ((double)this._rope.properLength < 0.0) { this._rope.properLength = vec2_1.length; } if ((double)vec2_1.length <= (double)this._rope.properLength) { return; } vec2_1 = vec2_1.normalized; if (this.duck != null) { this.duck.grappleMul = true; PhysicsObject duck = (PhysicsObject)this.duck; if (this.duck.ragdoll != null) { this.Degrapple(); } else { Vec2 position = duck.position; duck.position = this._rope.attach2.position + vec2_1 * this._rope.properLength; Vec2 vec2_2 = duck.position - duck.lastPosition; duck.hSpeed = vec2_2.x; duck.vSpeed = vec2_2.y; } } else { Vec2 position = this.position; this.position = this._rope.attach2.position + vec2_1 * this._rope.properLength; Vec2 vec2_2 = this.position - this.lastPosition; this.hSpeed = vec2_2.x; this.vSpeed = vec2_2.y; } }
public override void UpdateParts() { if (!this.doubleUpdating && Input.Down("JUMP")) { this.doubleUpdating = true; this.UpdateParts(); this.doubleUpdating = false; } if (!this.down && (double)this.yOffset > -1.0) { if ((double)this._initialWait < 1.0) { this._initialWait += 0.06f; } else if ((double)this._insertCoin < 1.0) { if (!this._chinged) { SFX.Play("ching", pitch: Rando.Float(0.4f, 0.6f)); this._chinged = true; } this._insertCoinInc += 0.008f; this._insertCoin += this._insertCoinInc; } else { this._insertCoin = 1f; if ((double)this._afterInsertWait < 1.0) { this._afterInsertWait += 0.2f; } else { if ((double)this._gachaWait >= 0.200000002980232 && !this.played) { this.played = true; SFX.Play("gachaSound", pitch: Rando.Float(-0.1f, 0.1f)); } if (!this._coined && (double)this._gachaWait > 0.200000002980232) { SFX.Play("gachaCoin", pitch: Rando.Float(0.4f, 0.6f)); this._coined = true; } this._gachaWait += 0.04f; if ((double)this._gachaWait >= 1.0) { this._gachaWait = 1f; this.gachaSpeed += 0.25f; if ((double)this.gachaSpeed > 6.0) { this.gachaSpeed = 6f; } this.gachaY += this.gachaSpeed; if ((double)this.gachaY > 50.0 && (double)this.gachaSpeed > 0.0) { if ((double)this.gachaSpeed > 0.800000011920929) { SFX.Play("gachaBounce", pitch: 0.2f); } this.gachaY = 50f; this.gachaSpeed = (float)(-(double)this.gachaSpeed * 0.400000005960464); } float num = 8f; this._toyVelocity.y += 0.2f; Vec2 toyPosition1 = this._toyPosition; if ((double)toyPosition1.length > (double)num) { Vec2 toyPosition2 = this._toyPosition; this._toyPosition = toyPosition1.normalized * num; Vec2 vec2 = this._toyPosition - toyPosition2; this._toyVelocity += vec2; if ((double)vec2.length > 1.0) { SFX.Play("gachaBounce", pitch: (0.7f + Rando.Float(0.2f))); } this._toyAngleLerp = Maths.PointDirection(Vec2.Zero, this._toyPosition); } Vec2 leftStick = InputProfile.active.leftStick; if (InputProfile.active.lastActiveDevice is Keyboard) { if (InputProfile.active.Down("LEFT")) { leftStick.x = -1f; } if (InputProfile.active.Down("RIGHT")) { leftStick.x = 1f; } if (InputProfile.active.Down("UP")) { leftStick.y = 1f; } if (InputProfile.active.Down("DOWN")) { leftStick.y = -1f; } } this._toyVelocity += (this._lastStick - leftStick) * new Vec2(2f, -2f); this._lastStick = leftStick; this._toyVelocity.x = Math.Max(Math.Min(this._toyVelocity.x, 3f), -3f); this._toyVelocity.y = Math.Max(Math.Min(this._toyVelocity.y, 3f), -3f); this._toyPosition += this._toyVelocity; if (!this.opened) { this._toyAngle = Lerp.FloatSmooth(this._toyAngle, this._toyAngleLerp, 0.1f); this._eggOffset = Lerp.Vec2Smooth(this._eggOffset, leftStick * 8f, 0.3f); } else { this._toyAngle = Lerp.FloatSmooth(this._toyAngle, -90f, 0.1f); this._eggOffset = Lerp.Vec2Smooth(this._eggOffset, Vec2.Zero, 0.3f); this._toyPosition = Lerp.Vec2Smooth(this._toyPosition, Vec2.Zero, 0.3f); } this._openWait += 0.029f; if ((double)this._openWait >= 1.0) { if (!this.didOpenToyCorner) { HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@OPEN TOY"); this.didOpenToyCorner = true; } if (Input.Pressed("SELECT") && !this.opened) { this.opened = true; SFX.Play("gachaOpen", pitch: Rando.Float(0.1f, 0.3f)); this._gachaEgg.frame += 2; } if (this.opened) { this._swapWait += 0.06f; if ((double)this._swapWait >= 1.0) { if (!this._swapped) { SFX.Play("harp"); HUD.CloseAllCorners(); HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@CONTINUE"); Profiles.experienceProfile.SetNumFurnitures((int)this._contains.index, Profiles.experienceProfile.GetNumFurnitures((int)this._contains.index) + 1); } this._starGrow += 0.05f; this._swapped = true; } } } } } } } this.yOffset = Lerp.FloatSmooth(this.yOffset, this.down ? -250f : 0.0f, 0.4f); if (this.down) { if (this._swapped) { this.finished = true; this.Close(); } else { this._downWait -= 0.06f; if ((double)this._downWait <= 0.0) { this._downWait = 1f; this.down = false; SFX.Play("gachaGet", pitch: -0.4f); } } } if (!this.down && this._swapped && Input.Pressed("SELECT")) { this.played = false; this._gachaWait = 0.0f; this._openWait = 0.0f; this.finished = false; this.opened = false; this._swapWait = 0.0f; this._swapped = false; this._starGrow = 0.0f; this._insertCoin = 0.0f; this._insertCoinInc = 0.0f; this._afterInsertWait = 0.0f; this._chinged = false; this.gachaY = 0.0f; this.gachaSpeed = 0.0f; this.doubleUpdating = false; ++this._prizesGiven; this._eggOffset = Vec2.Zero; this._toyPosition = Vec2.Zero; this._toyVelocity = Vec2.Zero; this._lastStick = Vec2.Zero; this._toyAngle = 0.0f; this._toyAngleLerp = 0.0f; this._coined = false; this._initialWait = 0.0f; this.didOpenToyCorner = false; HUD.CloseAllCorners(); SFX.Play("resume", 0.6f); if (this.prizes.Count > 4) { this.prizes.RemoveAt(0); this.LoadNextPrize(); } else { this.down = true; this._swapped = true; } } base.UpdateParts(); }