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() { 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(); }