public override void Update() { this._selectBeam.color = new Color(0.3f, (float)(0.300000011920929 + (double)this._wave2.normalized * 0.200000002980232), (float)(0.5 + (double)this._wave.normalized * 0.300000011920929)) * (1f + this._flash); this._flash = Maths.CountDown(this._flash, 0.1f); this._spawnWait -= 0.1f; if ((double)this._spawnWait < 0.0) { Level.Add((Thing) new BeamParticle(this.x, this.y + 190f, -0.8f - this._wave.normalized, false, Color.Cyan * 0.8f)); Level.Add((Thing) new BeamParticle(this.x, this.y + 190f, -0.8f - this._wave2.normalized, true, Color.LightBlue * 0.8f)); this._spawnWait = 1f; } foreach (Duck d in Level.CheckRectAll <Duck>(this.topLeft, this.bottomRight)) { if (d.isServerForObject) { this.TakeDuck(d); } } foreach (Holdable holdable in Level.CheckRectAll <Holdable>(this.topLeft, this.bottomRight)) { if (holdable.isServerForObject) { if (holdable is RagdollPart) { Duck captureDuck = (holdable as RagdollPart).doll.captureDuck; if (captureDuck != null) { (holdable as RagdollPart).doll.Unragdoll(); this.TakeDuck(captureDuck); } } else if (holdable.owner == null && !this._guns.Contains((Thing)holdable)) { this._guns.Add((Thing)holdable); } } } int count = this._ducks.Count; int num1 = 0; float num2 = (float)((double)this._beamHeight / (double)count / 2.0 + 20.0 * (count > 1 ? 1.0 : 0.0)); float num3 = (float)(((double)this._beamHeight - (double)num2 * 2.0) / (count > 1 ? (double)(count - 1) : 1.0)); for (int index = 0; index < this._ducks.Count; ++index) { BeamDuck duck = this._ducks[index]; if (duck.leaving) { duck.duck.solid = true; duck.duck.y = MathHelper.Lerp(duck.duck.position.y, duck.entryHeight, 0.35f); duck.duck.vSpeed = 0.0f; if ((double)Math.Abs(duck.duck.position.y - duck.entryHeight) < 4.0) { duck.duck.position.y = duck.entryHeight; duck.duck.hSpeed = (float)duck.entryDir * 3f; duck.duck.vSpeed = 0.0f; } if ((double)Math.Abs(duck.duck.position.x - this.x) > 24.0) { duck.duck.gravMultiplier = 1f; duck.duck.immobilized = false; duck.duck.beammode = false; this._ducks.RemoveAt(index); --index; continue; } } else { duck.duck.position.x = Lerp.FloatSmooth(duck.duck.position.x, this.position.x + (float)duck.sin2 * 1f, 0.4f); duck.duck.position.y = Lerp.FloatSmooth(duck.duck.position.y, (float)((double)num2 + (double)num3 * (double)index + (double)(float)duck.sin * 2.0), 0.1f); duck.duck.vSpeed = 0.0f; duck.duck.hSpeed = 0.0f; duck.duck.gravMultiplier = 0.0f; } if (duck.duck.inputProfile.Pressed("QUACK") && (double)Math.Abs(duck.duck.position.x - this.x) < 2.0) { duck.leaving = true; } ++num1; } for (int index = 0; index < this._guns.Count; ++index) { Thing gun = this._guns[index]; gun.vSpeed = 0.0f; gun.hSpeed = 0.0f; if ((double)Math.Abs(this.position.x - gun.position.x) < 6.0) { gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y - 3f), 0.1f); gun.alpha = Maths.LerpTowards(gun.alpha, 0.0f, 0.1f); if ((double)gun.alpha <= 0.0) { gun.y = -200f; this._guns.RemoveAt(index); --index; } } else { gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y), 0.2f); } } base.Update(); }
public override void Update() { this._selectBeam.color = new Color(0.5f, (float)(0.200000002980232 + (double)this._wave2.normalized * 0.200000002980232), (float)(0.300000011920929 + (double)this._wave.normalized * 0.300000011920929)) * (1f + this._flash); this._flash = Maths.CountDown(this._flash, 0.1f); this._spawnWait -= 0.025f; if ((double)this._spawnWait < 0.0) { Level.Add((Thing) new MultiBeamParticle(this.x, this.y + 190f, -0.8f - this._wave.normalized, false, Color.Cyan * 0.8f)); Level.Add((Thing) new MultiBeamParticle(this.x, this.y + 190f, -0.8f - this._wave2.normalized, true, Color.LightBlue * 0.8f)); this._spawnWait = 1f; } using (IEnumerator <Duck> enumerator = Level.CheckRectAll <Duck>(this.position - this.center, this.position - this.center + new Vec2(this._collisionSize.x, this._collisionSize.y)).GetEnumerator()) { while (enumerator.MoveNext()) { Duck d = enumerator.Current; if (!this._ducks.Any <BeamDuck>((Func <BeamDuck, bool>)(t => t.duck == d))) { float num = (double)d.y >= 100.0 ? 130f : 40f; SFX.Play("stepInBeam"); 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; 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) }); this.entered = true; } } } foreach (Holdable holdable in Level.CheckRectAll <Holdable>(this.position - this.center, this.position - this.center + new Vec2(this._collisionSize.x, this._collisionSize.y))) { if (holdable.owner == null && !this._guns.Contains((Thing)holdable)) { this._guns.Add((Thing)holdable); } } int count = this._ducks.Count; int num1 = 0; float num2 = 150f; float num3 = (float)(((double)this._beamHeight - (double)num2 * 2.0) / (count > 1 ? (double)(count - 1) : 1.0)); for (int index = 0; index < this._ducks.Count; ++index) { BeamDuck duck = this._ducks[index]; if (duck.leaving) { duck.duck.solid = true; duck.duck.hSpeed = this._leaveLeft ? -4f : 4f; duck.duck.vSpeed = 0.0f; if ((double)Math.Abs(duck.duck.position.x - this.x) > 24.0) { duck.duck.immobilized = false; this._ducks.RemoveAt(index); --index; continue; } } else { duck.duck.position.x = Lerp.FloatSmooth(duck.duck.position.x, this.position.x + (float)duck.sin2 * 1f, 0.2f); duck.duck.position.y = Lerp.FloatSmooth(duck.duck.position.y, (float)((double)num2 + (double)num3 * (double)index + (double)(float)duck.sin * 2.0), 0.08f); duck.duck.vSpeed = 0.0f; duck.duck.hSpeed = 0.0f; } if (!TitleScreen.hasMenusOpen && duck.duck.inputProfile.Pressed("LEFT")) { duck.leaving = true; this._leaveLeft = true; duck.duck.offDir = (sbyte)-1; this.entered = false; } ++num1; } for (int index = 0; index < this._guns.Count; ++index) { Thing gun = this._guns[index]; gun.vSpeed = 0.0f; gun.hSpeed = 0.0f; if ((double)Math.Abs(this.position.x - gun.position.x) < 6.0) { gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y - 3f), 0.1f); gun.alpha = Maths.LerpTowards(gun.alpha, 0.0f, 0.1f); if ((double)gun.alpha <= 0.0) { gun.y = -200f; this._guns.RemoveAt(index); --index; } } else { gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y), 0.2f); } } base.Update(); }
public override void Update() { if ((double)this._slideWait < 0.0) { this.position = Vec2.Lerp(this.position, this._end, 0.15f); } this._slideWait -= 0.4f; DuckGame.Graphics.SetRenderTarget(this._faceTarget); DuckGame.Graphics.Clear(Color.Transparent); DuckGame.Graphics.screen.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.DepthRead, RasterizerState.CullNone, (MTEffect)null, Matrix.Identity); this._gradient.depth = new Depth(-0.6f); this._gradient.alpha = 0.5f; if (this._team.activeProfiles.Count == 1) { this._gradient.color = this._team.activeProfiles[0].persona.colorUsable; } else { switch (Teams.CurrentGameTeamIndex(this._team)) { case 0: this._gradient.color = Color.Red; break; case 1: this._gradient.color = Color.Blue; break; case 2: this._gradient.color = Color.LimeGreen; break; } } DuckGame.Graphics.Draw(this._gradient, 0.0f, 0.0f); this._edgeOverlay.depth = new Depth(0.9f); this._edgeOverlay.alpha = 0.5f; DuckGame.Graphics.Draw(this._edgeOverlay, 0.0f, 0.0f); int num = 0; foreach (Profile activeProfile in this._team.activeProfiles) { float x = (float)((num * 8 + 8) * 2); float y = 16f; activeProfile.persona.quackSprite.depth = new Depth(0.7f); activeProfile.persona.quackSprite.scale = new Vec2(2f, 2f); DuckGame.Graphics.Draw(activeProfile.persona.quackSprite, 0, x, y, 2f, 2f); activeProfile.persona.quackSprite.color = Color.White; activeProfile.persona.quackSprite.scale = new Vec2(1f, 1f); Vec2 hatPoint = DuckRig.GetHatPoint(activeProfile.persona.sprite.imageIndex); activeProfile.team.hat.depth = new Depth(0.8f); activeProfile.team.hat.center = new Vec2(16f, 16f) + activeProfile.team.hatOffset; activeProfile.team.hat.scale = new Vec2(2f, 2f); if ((double)activeProfile.team.hat.texture.width > 16.0) { activeProfile.team.hat.frame = 1; } DuckGame.Graphics.Draw(activeProfile.team.hat, activeProfile.team.hat.frame, x + hatPoint.x * 2f, y + hatPoint.y * 2f, 2f, 2f); activeProfile.team.hat.color = Color.White; activeProfile.team.hat.scale = new Vec2(1f, 1f); activeProfile.team.hat.frame = 0; ++num; } DuckGame.Graphics.screen.End(); DuckGame.Graphics.SetRenderTarget((RenderTarget2D)null); base.Update(); }