public override void Update() { if (!this._created) { this._created = true; } if (this._sprite.frame > this._smokeFrame && !this._smoked) { int num = Graphics.effectsLevel == 2 ? Rando.Int(1, 4) : 1; for (int index = 0; index < num; ++index) { SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-5f, 5f), this.y + Rando.Float(-5f, 5f)); smallSmoke.vSpeed = Rando.Float(0.0f, -0.5f); smallSmoke.xscale = smallSmoke.yscale = Rando.Float(0.2f, 0.7f); Level.Add((Thing)smallSmoke); } this._smoked = true; } if ((double)this._wait <= 0.0) { this.y += this.vSpeed; } if (!this._sprite.finished) { return; } Level.Remove((Thing)this); }
protected override void CreateExplosion(Vec2 pos) { float x = pos.x; float y = pos.y - 2f; Level.Add(new Frog(x, y, Rando.Double() < 0.5f)); int amount = Rando.Int(2, 4); for (int i = 0; i < amount; i++) { float deg = (float)i * 360f / amount + Rando.Float(-10f, 10f); float rad = Maths.DegToRad(deg); float xDir = (float)Math.Cos(rad); float yDir = (float)Math.Sin(rad); Frog thing = new Frog(x, y, xDir > 0); thing.hSpeed = xDir * 3; thing.vSpeed = yDir * yDir * -3 - 2; Level.Add(thing); } for (int i = 0; i < 3; i++) { Level.Add(SmallSmoke.New(x + Rando.Float(-8f, 8f), y + Rando.Float(-8f, 8f))); } }
public override void Update() { this.spawnTime = 4f; if (this._present != null && this._present.removeFromLevel) { this._present = (CTFPresent)null; } CTFPresent ctfPresent1 = (CTFPresent)null; CTFPresent ctfPresent2 = (CTFPresent)null; foreach (CTFPresent ctfPresent3 in Level.CheckCircleAll <CTFPresent>(this.position, 16f)) { if (ctfPresent3 != this._present) { ctfPresent2 = ctfPresent3; } else { ctfPresent1 = ctfPresent3; } } if (ctfPresent2 != null & ctfPresent1 != null) { if (ctfPresent2.duck != null) { ctfPresent2.duck.ThrowItem(); } Level.Remove((Thing)ctfPresent2); Level.Add((Thing)SmallSmoke.New(ctfPresent2.x, ctfPresent2.y)); CTF.CaptureFlag((bool)this.team); SFX.Play("equip"); } base.Update(); }
public override void Update() { if ((double)Rando.Float(2f) < 0.300000011920929) { this.vSpeed += Rando.Float(3.5f) - 2f; } if ((double)Rando.Float(9f) < 0.100000001490116) { this.vSpeed += Rando.Float(3.1f) - 3f; } if ((double)Rando.Float(14f) < 0.100000001490116) { this.vSpeed += Rando.Float(4f) - 5f; } if ((double)Rando.Float(25f) < 0.100000001490116) { this.vSpeed += Rando.Float(6f) - 7f; } Level.Add((Thing)SmallSmoke.New(this.x, this.y)); if ((double)this.hSpeed > 0.0) { this._sprite.angleDegrees = 90f; } else if ((double)this.hSpeed < 0.0) { this._sprite.angleDegrees = -90f; } base.Update(); }
protected override bool OnDestroy(DestroyType type = null) { if (type is DTIncinerate) { Level.Remove((Thing)this); Level.Add((Thing)SmallSmoke.New(this.x, this.y)); } return(false); }
public override void Terminate() { if (!(Level.current is Editor)) { Level.Add(SmallSmoke.New(base.x, base.y)); Level.Add(SmallSmoke.New(base.x + 4f, base.y)); Level.Add(SmallSmoke.New(base.x - 4f, base.y)); Level.Add(SmallSmoke.New(base.x, base.y + 4f)); Level.Add(SmallSmoke.New(base.x, base.y - 4f)); } base.Terminate(); }
public override void Update() { if (!this.burntOut && (double)this.burnt >= 1.0) { this._sprite.frame = 1; Vec2 vec2 = this.Offset(new Vec2(10f, 0.0f)); Level.Add((Thing)SmallSmoke.New(vec2.x, vec2.y)); this._onFire = false; this.flammable = 0.0f; this.burntOut = true; } base.Update(); }
public override void OnCollide(Vec2 pos, Thing t, bool willBeStopped) { if (!willBeStopped) { return; } SFX.PlaySynchronized("ignite", 1, 0.7f); for (int i = 0; i < 6; i++) { SmallSmoke smallSmoke = SmallSmoke.New(pos.x + Rando.Float(-5f, 5f), pos.y + Rando.Float(-5f, 5f), 0.8f, 4); smallSmoke.vSpeed = Rando.Float(0f, -0.5f); smallSmoke.xscale = smallSmoke.yscale = Rando.Float(0.2f, 0.7f); Level.Add(smallSmoke); } DestroyRadius(pos, 40, this); }
public void MakeEffects() { if (this.sounded) { return; } Level.Add((Thing)SmallSmoke.New(this.x, this.y + 2f)); Level.Add((Thing)SmallSmoke.New(this.x, this.y - 16f)); SFX.Play("doorBreak"); for (int index = 0; index < 8; ++index) { Thing thing = (Thing)WoodDebris.New(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f)); thing.hSpeed = ((double)Rando.Float(1f) > 0.5 ? 1f : -1f) * Rando.Float(3f); thing.vSpeed = -Rando.Float(1f); Level.Add(thing); } this.sounded = true; }
public override void Update() { base.Update(); if (lifetime < 0) { Explosion.Create(this, position, new Explosion.Config(ExplosionShrapnel, DuckUtils.GetAsset("sounds/frog_explosion.wav"), false)); for (int i = 0; i < 2; i++) { Level.Add(SmallSmoke.New(x + Rando.Float(-8f, 8f), y + Rando.Float(-8f, 8f))); } Level.Remove(this); } else { lifetime -= Maths.IncFrameTimer(); } UpdateBehavior(); }
public void Fire(Vec2 point, Vec2 travel) { if (!this._inGun) { return; } this._inGun = false; this.position = point + travel * -2f; this._stuck = true; if (!this.noisy) { return; } SFX.Play("grappleHook", 0.5f); for (int index = 0; index < 6; ++index) { Level.Add((Thing)Spark.New(point.x - travel.x * 2f, point.y - travel.y * 2f, travel)); } for (int index = 0; index < 1; ++index) { Level.Add((Thing)SmallSmoke.New(point.x + Rando.Float(-2f, 2f), point.y + Rando.Float(-2f, 2f))); } }
public override void OnPressAction() { if (this.loaded && this.ammo > 1) { base.OnPressAction(); for (int index = 0; index < 4; ++index) { Level.Add((Thing)Spark.New(this.offDir > (sbyte)0 ? this.x - 9f : this.x + 9f, this.y - 6f, new Vec2(Rando.Float(-1f, 1f), -0.5f), 0.05f)); } for (int index = 0; index < 4; ++index) { Level.Add((Thing)SmallSmoke.New(this.barrelPosition.x + (float)this.offDir * 4f, this.barrelPosition.y)); } this.ammo = 1; } else { if (this._loadState != -1) { return; } this._loadState = 0; } }
public override void Update() { base.Update(); //Animations if (ammo >= 3) { sprite.SetAnimation("3"); } else if (ammo == 2) { sprite.SetAnimation("2"); } else if (ammo == 1) { sprite.SetAnimation("1"); } else { sprite.SetAnimation("0"); } if (tempX != 0f && tempY != 0f) { d = new DuckPlaceHolder(tempX, tempY); Level.Add(new DuckPlaceHolder(tempX, tempY)); } if (g != null && g._timer <= 0.1f && teleported == false) { tempX = g.position.x; tempY = g.position.y - 10f; teleported = true; } if (duck != null) { if (g != null && teleported == false && duck != null) { if (g._timer <= 0.1f) { tempX = g.position.x; tempY = g.position.y - 10f; teleported = true; } } if (g != null && tempX != 0f && tempY != 0f && teleported == true) { if (g._destroyed == true) { teleTimer = teleTimer - 0.01f; if (teleTimer <= 0.03f) { Level.Add(SmallSmoke.New(duck.position.x, duck.position.y)); if (duck.ragdoll != null) { duck.ragdoll.position.x = tempX; duck.ragdoll.position.y = tempY; } else { duck.position.x = tempX; duck.position.y = tempY; } Level.Add(SmallSmoke.New(duck.position.x, duck.position.y)); duck.vSpeed = -0.5f; g = null; teleported = false; tempX = 0f; tempY = 0f; teleTimer = 0.06f; SFX.Play(GetPath("/sfx/teleport"), 1f, 0f, 0f, false); Level.Remove(d); level.RemoveThing(d); d = null; } } } } if (_aiming && _aimWait <= 0f && _fireAngle < 80f) { _ammoType.bulletSpeed += 0.3f; _fireAngle += 7f; } if (_aimWait > 0.0) { _aimWait -= 0.9f; } if (_cooldown > 0.0) { _cooldown -= 0.1f; } else { _cooldown = 0f; } if (owner != null) { _aimAngle = -Maths.DegToRad(_fireAngle); if (offDir < 0) { _aimAngle = -_aimAngle; } } else { _aimWait = 0f; _aiming = false; _aimAngle = 0f; _fireAngle = 0f; } if (!_raised) { return; } _aimAngle = 0.0f; }
public override void Update() { base.Update(); this._sprite.currentAnimation = (this._receivingSignal ? "beep" : "idle"); this._idle.lerpVolume = Math.Min(this._idleSpeed * 10f, 0.7f); if (base._destroyed) { this._idle.lerpVolume = 0f; this._idle.lerpSpeed = 1f; } this._idle.pitch = 0.5f + this._idleSpeed * 0.5f; if (this.moveLeft) { if (this.hSpeed > -this._maxSpeed) { this.hSpeed -= 0.4f; } else { this.hSpeed = -this._maxSpeed; } this.offDir = -1; this._idleSpeed += 0.03f; this._inc++; } if (this.moveRight) { if (this.hSpeed < this._maxSpeed) { this.hSpeed += 0.4f; } else { this.hSpeed = this._maxSpeed; } this.offDir = 1; this._idleSpeed += 0.03f; this._inc++; } if (this._idleSpeed > 0.1f) { this._inc = 0; Level.Add(SmallSmoke.New(base.x - (float)(this.offDir * 10), base.y)); } if (!this.moveLeft && !this.moveRight) { this._idleSpeed -= 0.03f; } if (this._idleSpeed > 1f) { this._idleSpeed = 1f; } if (this._idleSpeed < 0f) { this._idleSpeed = 0f; } if (this.jump && base.grounded) { this.vSpeed -= 4.8f; } this._tilt = MathHelper.Lerp(this._tilt, -this.hSpeed, 0.4f); this._waveMult = MathHelper.Lerp(this._waveMult, -this.hSpeed, 0.1f); base.angleDegrees = this._tilt * 2f + this._wave.value * (this._waveMult * (this._maxSpeed - Math.Abs(this.hSpeed))); if (base.isServerForObject && base.y > Level.current.lowestPoint + 100f && !this.destroyed) { this.Destroy(new DTFall()); } }
public static void Update() { foreach (SmallFire smallFire in Level.current.things[typeof(SmallFire)]) { if (smallFire.fireID == FireManager._curUpdateID && (double)smallFire.alpha > 0.5) { Thing thing = (Thing)null; if (smallFire.stick != null && smallFire.stick is DartGun) { thing = smallFire.stick.owner; } smallFire.doFloat = false; foreach (MaterialThing materialThing in Level.CheckCircleAll <MaterialThing>(smallFire.position + new Vec2(0.0f, -4f), 6f)) { if (materialThing.isServerForObject && materialThing != thing) { if (materialThing is FluidPuddle) { smallFire.doFloat = true; FluidPuddle fluidPuddle = materialThing as FluidPuddle; if ((double)fluidPuddle.data.flammable <= 0.5 && (double)fluidPuddle.data.heat < 0.5) { Level.Remove((Thing)smallFire); break; } } if (materialThing is Duck duck && ((double)duck.slideBuildup > 0.0 && duck.sliding || duck.holdObject is Sword && (duck.holdObject as Sword)._slamStance)) { SmallSmoke smallSmoke = SmallSmoke.New(smallFire.x + Rando.Float(-1f, 1f), smallFire.y + Rando.Float(-1f, 1f)); smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f); Level.Add((Thing)smallSmoke); Level.Remove((Thing)smallFire); } // remove this //else if ((double) Rando.Float(1000f) < (double) materialThing.flammable * 1000.0 && (smallFire.whoWait == null || duck != smallFire.whoWait)) // materialThing.Burn(smallFire.position + new Vec2(0.0f, 4f), (Thing) smallFire); //materialThing.DoHeatUp(0.05f, smallFire.position); } } } } foreach (FluidPuddle fluidPuddle in Level.current.things[typeof(FluidPuddle)]) { if ((double)fluidPuddle.data.flammable <= 0.5) { fluidPuddle.onFire = false; } else if (fluidPuddle.onFire && (double)fluidPuddle.fireID == (double)FireManager._curUpdateID && (double)fluidPuddle.alpha > 0.5) { foreach (MaterialThing materialThing in Level.CheckRectAll <MaterialThing>(fluidPuddle.topLeft + new Vec2(0.0f, -4f), fluidPuddle.topRight + new Vec2(0.0f, 2f))) { if (materialThing != fluidPuddle) { if ((!(materialThing is Duck duck) || (double)duck.slideBuildup <= 0.0) && (double)Rando.Float(1000f) < (double)materialThing.flammable * 1000.0) { materialThing.Burn(fluidPuddle.position + new Vec2(0.0f, 4f), (Thing)fluidPuddle); } materialThing.DoHeatUp(0.05f, fluidPuddle.position); } } } else if (!fluidPuddle.onFire) { Rectangle rectangle = fluidPuddle.rectangle; foreach (Spark spark in Level.current.things[typeof(Spark)]) { if ((double)spark.x > (double)rectangle.x && (double)spark.x < (double)rectangle.x + (double)rectangle.width && ((double)spark.y > (double)rectangle.y && (double)spark.y < (double)rectangle.y + (double)rectangle.height)) { fluidPuddle.Burn(fluidPuddle.position, (Thing)spark); break; } } } } foreach (ExtinguisherSmoke extinguisherSmoke in Level.current.things[typeof(ExtinguisherSmoke)]) { if (extinguisherSmoke.smokeID == FireManager._curUpdateID) { foreach (SmallFire smallFire in Level.CheckCircleAll <SmallFire>(extinguisherSmoke.position + new Vec2(0.0f, -8f), 12f)) { if ((double)extinguisherSmoke.scale.x > 1.0) { smallFire.SuckLife(10f); } } foreach (MaterialThing materialThing in Level.CheckCircleAll <MaterialThing>(extinguisherSmoke.position + new Vec2(0.0f, -8f), 4f)) { if ((double)extinguisherSmoke.scale.x > 1.0) { materialThing.spreadExtinguisherSmoke = 1f; } if (materialThing.onFire && (double)Rando.Float(1000f) > (double)materialThing.flammable * 650.0) { materialThing.Extinquish(); } } } } ++FireManager._curUpdateID; if (FireManager._curUpdateID <= 20) { return; } FireManager._curUpdateID = 0; }
public override void Update() { base.Update(); if (!this._pin) { this._timer -= 0.01f; } if (this._timer < 0.5f && this.owner == null && !this._didBonus) { this._didBonus = true; if (Recorder.currentRecording != null) { Recorder.currentRecording.LogBonus(); } } if (!this._localDidExplode && this._timer < 0f) { if (this._explodeFrames < 0) { this.CreateExplosion(this.position); this._explodeFrames = 4; } else { this._explodeFrames--; if (this._explodeFrames == 0) { float cx = base.x; float cy = base.y - 2f; Graphics.flashAdd = 1.3f; Layer.Game.darken = 1.3f; if (base.isServerForObject) { for (int i = 0; i < 20; i++) { SFX.Play(GetPath("/sfx/teleport"), 1f, 0f, 0f, false); if (duck != null) { d = duck; } else if (prevOwner != null) { d = (Duck)prevOwner; } else if (_equippedDuck != null) { d = _equippedDuck; } Level.Add(SmallSmoke.New(d.position.x, d.position.y)); if (d.ragdoll != null) { d.ragdoll.position.x = this.position.x; d.ragdoll.position.y = this.position.y - 10f; } else { d.position.x = this.position.x; d.position.y = this.position.y - 10f; } Level.Add(SmallSmoke.New(d.position.x, d.position.y)); d.vSpeed = -0.5f; Level.Remove(this); base._destroyed = true; this._explodeFrames = -1; } System.Collections.Generic.IEnumerable <Window> windows = Level.CheckCircleAll <Window>(this.position, 40f); foreach (Window w in windows) { if (Level.CheckLine <Block>(this.position, w.position, w) == null) { w.Destroy(new DTImpact(this)); } } this.bulletFireIndex += 20; if (Network.isActive) { NMFireGun gunEvent = new NMFireGun(this, this.firedBullets, this.bulletFireIndex, false, 4, false); Send.Message(gunEvent, NetMessagePriority.ReliableOrdered, null); this.firedBullets.Clear(); } } } } if (base.prevOwner != null && this._cookThrower == null) { this._cookThrower = (base.prevOwner as Duck); this._cookTimeOnThrow = this._timer; } } }