public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (!this.kill && (double)with.impactPowerV > 2.0) { float num1 = with.impactPowerV; float num2 = with.impactDirectionH; if ((double)num1 > 6.0) { num1 = 6f; } if ((double)num2 > 6.0) { num2 = 6f; } for (int index = 0; index < 20; ++index) { float num3 = 1f; if (index < 10) { num3 = 0.7f; } Level.Add((Thing) new SnowFallParticle(this.x + Rando.Float(-8f, 8f), this.y + Rando.Float(-6f, 0.0f), new Vec2((float)((double)num2 * (double)num3 * 0.100000001490116) + Rando.Float((float)(-0.200000002980232 * ((double)num1 * (double)num3)), (float)(0.200000002980232 * ((double)num1 * (double)num3))), (float)(-(double)Rando.Float(0.8f, 1.5f) * ((double)num1 * (double)num3 * 0.150000005960464))), index < 6)); } this.kill = true; } base.OnSoftImpact(with, from); }
public override void OnImpact(MaterialThing with, ImpactedFrom from) { if (from == ImpactedFrom.Top) { float grav = with is PhysicsObject ? (with as PhysicsObject).currentGravity : 0.2f; with.vSpeed = -TopCollisionVerticalEnergy * grav; with.hSpeed = (offDir > 0 ? TopCollisionHorizontalEnergy : -TopCollisionHorizontalEnergy); if (with is Gun) { (with as Gun).PressAction(); } } if (offDir > 0 && from == ImpactedFrom.Right) { with.hSpeed = CollisionEnergy; if (with is Gun) { (with as Gun).PressAction(); } } if (offDir < 0 && from == ImpactedFrom.Left) { with.hSpeed = -CollisionEnergy; if (with is Gun) { (with as Gun).PressAction(); } } base.OnImpact(with, from); }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (this.hidden) { return; } switch (with) { case Duck _: case RagdollPart _: case TrappedDuck _: if (with.destroyed) { break; } this.visible = false; this.hidden = true; if (this.collectSound != null && this.collectSound != "") { SFX.Play(this.collectSound, 0.8f); } if (Level.current is Editor) { break; } this._sequence.Finished(); if (!ChallengeLevel.running || !this.sequence.isValid) { break; } ++ChallengeLevel.goodiesGot; break; } }
public override void OnImpact(MaterialThing with, ImpactedFrom from) { if (!this._pin && with is Duck) { this._timer = 0.01f; } }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { if (this.pullOnImpact) { this.OnPressAction(); } base.OnSolidImpact(with, from); }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (this._inGun || !(with is Block)) { return; } this._stuck = true; }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (!HasPin) { Explode(); } base.OnSoftImpact(with, from); }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (!HasPin) { // Have it stop on boxes and other props } base.OnSoftImpact(with, from); }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { if (!this.melted && with is PhysicsObject) { (with as PhysicsObject).specialFrictionMod = 0.16f; (with as PhysicsObject).modFric = true; } base.OnSolidImpact(with, from); }
public override void Touch(MaterialThing with) { if (with.destroyed) { return; } with.Destroy((DestroyType) new DTImpale((Thing)this)); with.vSpeed = 3f; }
public override void BulletOnHit(MaterialThing thing, ref bool willStop) { base.BulletOnHit(thing, ref willStop); if (willStop) { Blast(BlastHitDir.Random360); blasted = true; } }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { if ((double)with.impactPowerV > 2.40000009536743) { Level.CheckPoint <PineTree>(this.x, this.y)?.KnockOffSnow(with.velocity, true); Level.CheckPoint <PineTree>(this.x, this.y - 16f)?.KnockOffSnow(with.velocity, true); } this.OnSoftImpact(with, from); }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (with as Duck != null && !_pin) { _timer = 0; Level.Remove(this); } base.OnSoftImpact(with, from); }
public override void Touch(MaterialThing with) { if (with is Duck duck && duck.holdObject is Sword && (duck.holdObject as Sword)._slamStance || with.destroyed) { return; } with.Destroy((DestroyType) new DTImpale((Thing)this)); with.vSpeed = -3f; }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (!HasPin) { if (with as Duck != null) // detect if you hit a duck { Timer = 0; // Explode instantly if hit on duck } } base.OnSoftImpact(with, from); }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (from == ImpactedFrom.Bottom && this.hitWait == 0f && with.isServerForObject) { with.Fondle(this); } if (base.isServerForObject && from == ImpactedFrom.Bottom && this.hitWait == 0f) { this.hitWait = 1f; Holdable h = with as Holdable; if (h != null && (h.lastThrownBy != null || (h is RagdollPart && !Network.isActive))) { Duck d = h.lastThrownBy as Duck; if (h is RagdollPart) { return; } if (d != null) { StoreItem(d.profile, with); } base.Bounce(); return; } else { Duck duck = with as Duck; if (duck != null) { StoredItem item = GetStoredItem(duck.profile); if (item.type != null) { base.contains = item.type; this._contextThing = item.thing; base.Pop(); this._hit = false; } else { SFX.Play("scanFail", 1f, 0f, 0f, false); base.Bounce(); } if (duck.holdObject != null) { Holdable hold = duck.holdObject; if (hold != null) { StoreItem(duck.profile, hold); } } } } } }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { if (!this.melted) { if (with is PhysicsObject) { (with as PhysicsObject).specialFrictionMod = 0.16f; (with as PhysicsObject).modFric = true; } } else if (Graphics.frame - this.lastHitFrame > 3L && (double)with.totalImpactPower > 2.5 && (double)with.impactPowerV > 0.5) { int num = (int)((double)with.totalImpactPower * 0.5); if (num > 6) { num = 6; } if (num < 3) { num = 3; } switch (from) { case ImpactedFrom.Left: for (int index = 0; index < num; ++index) { Level.Add((Thing) new SnowFallParticle(this.right - Rando.Float(0.0f, 1f), with.y + Rando.Float(-6f, 6f), new Vec2(Rando.Float(0.3f, 1f), Rando.Float(-0.5f, 0.5f)))); } break; case ImpactedFrom.Right: for (int index = 0; index < num; ++index) { Level.Add((Thing) new SnowFallParticle(this.left - Rando.Float(0.0f, 1f), with.y + Rando.Float(-6f, 6f), new Vec2(-Rando.Float(0.3f, 1f), Rando.Float(-0.5f, 0.5f)))); } break; case ImpactedFrom.Top: for (int index = 0; index < num; ++index) { Level.Add((Thing) new SnowFallParticle(with.x + Rando.Float(-6f, 6f), this.bottom + Rando.Float(0.0f, 1f), new Vec2(Rando.Float(-0.5f, 0.5f), Rando.Float(0.3f, 1f)))); } break; case ImpactedFrom.Bottom: for (int index = 0; index < num; ++index) { Level.Add((Thing) new SnowFallParticle(with.x + Rando.Float(-6f, 6f), this.top - Rando.Float(0.0f, 1f), new Vec2(Rando.Float(-0.5f, 0.5f), -Rando.Float(0.3f, 1f)))); } break; } } this.OnSoftImpact(with, from); }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { if (!HasPin) { Explode(); } if (pullOnImpact) { OnPressAction(); } base.OnSolidImpact(with, from); }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { Vec2 collisionVelocity = new Vec2(with.hSpeed - this.hSpeed, with.vSpeed - this.vSpeed); float lengthSq = collisionVelocity.lengthSq; if (lengthSq > 8.5f * 8.5f) { HasPin = false; } base.OnSolidImpact(with, from); }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { if (!HasPin) // look into this.owner and Disarm. See Duck class for more details { SFX.Play(GetPath("sounds/flashbang_csgo.wav")); Level.Remove(this); } if (pullOnImpact) { OnPressAction(); } base.OnSolidImpact(with, from); }
public override void OnImpact(MaterialThing with, ImpactedFrom from) { if (!this.isServerForObject || with == this._owner || (with is Gun || (double)with.weight < 5.0)) { return; } if (with is PhysicsObject) { with.hSpeed = this.hSpeed / 4f; --with.vSpeed; } this.Destroy((DestroyType) new DTImpact((Thing)null)); with.Burn(this.position, (Thing)this); }
public override void OnImpact(MaterialThing with, ImpactedFrom from) { if (with is Duck && Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed) >= 2f) { if (isServerForObject) { if (with.isServerForObject) { this.EquipGun(with as Duck); } } this.y = 9999f; } }
public static SmallFire New( float xpos, float ypos, float hspeed, float vspeed, bool shortLife = false, MaterialThing stick = null, bool canMultiply = true, Thing firedFrom = null, bool network = false) { SmallFire smallFire; if (Network.isActive) { smallFire = new SmallFire(); } else if (SmallFire._objects[SmallFire._lastActiveObject] == null) { smallFire = new SmallFire(); SmallFire._objects[SmallFire._lastActiveObject] = smallFire; } else { smallFire = SmallFire._objects[SmallFire._lastActiveObject]; } SmallFire._lastActiveObject = (SmallFire._lastActiveObject + 1) % SmallFire.kMaxObjects; if (smallFire != null) { smallFire.ResetProperties(); smallFire.Init(xpos, ypos, hspeed, vspeed, shortLife, stick, canMultiply); smallFire._sprite.globalIndex = (int)Thing.GetGlobalIndex(); smallFire._airFire.globalIndex = (int)Thing.GetGlobalIndex(); smallFire._firedFrom = firedFrom; smallFire.needsSynchronization = true; smallFire.isLocal = !network; if (Network.isActive && !network) { GhostManager.context.particleManager.AddLocalParticle((PhysicsParticle)smallFire); } if (float.IsNaN(smallFire.position.x) || float.IsNaN(smallFire.position.y)) { smallFire.position.x = -9999f; smallFire.position.y = -9999f; } } return(smallFire); }
public override void LegacyImpact(MaterialThing thing) { Duck?duck = thing switch { Duck d when d != BulletSafeDuck => d, RagdollPart ragdollPart => ragdollPart.duck, _ => null, }; if (duck is not null) { return; } base.LegacyImpact(thing); }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (with as Duck != null && !_pin && !hasImpacted && with != this.previousOwner) { var duck = (Duck)with; ExplosiveVest vest = (ExplosiveVest)Editor.CreateThing(typeof(ExplosiveVest)); vest.x = duck.x; vest.y = duck.y; vest.detonator = this; Level.Add(vest); this.vest = (ExplosiveVest)vest; duck.Equip((Equipment)vest); duck.GiveHoldable(this); hasImpacted = true; } }
public override void Touch(MaterialThing with) { if ((double)with.vSpeed < 12.0) { with.vSpeed = 12f; } if (with is Gun) { (with as Gun).PressAction(); } if (with is Duck) { (with as Duck).jumping = false; } with.lastHSpeed = with._hSpeed; with.lastVSpeed = with._vSpeed; this.SpringUp(); }
public override void Touch(MaterialThing with) { base.Touch(with); if (_cooldown > 0) { return; } if (!(with is Duck duck1)) { return; } if (!TryPick(duck1)) { return; } SFX.Play(_pickSound); Level.Remove(this); }
public override bool BulletCanDestory(MaterialThing thing) { Duck?duck = thing switch { Duck d when d != BulletSafeDuck => d, RagdollPart ragdollPart => ragdollPart.duck, _ => null, }; if (duck is null) { goto notDuck; } duck.onFire = true; return(false); notDuck: return(base.BulletCanDestory(thing)); }
public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (with is PhysicsObject) { if (this._orientation == 0 && (double)with.vSpeed > -0.100000001490116) { this._button.ButtonPressed(with as PhysicsObject); } else if (this._orientation == 1 && (double)with.hSpeed < 0.100000001490116) { this._button.ButtonPressed(with as PhysicsObject); } else if (this._orientation == 2 && (double)with.vSpeed < 0.100000001490116) { this._button.ButtonPressed(with as PhysicsObject); } else if (this._orientation == 3 && (double)with.hSpeed > -0.100000001490116) { this._button.ButtonPressed(with as PhysicsObject); } } base.OnSoftImpact(with, from); }
public override void OnImpact(MaterialThing with, ImpactedFrom from) { if (this._stuck || with is Gun || (double)with.weight < 5.0 && !(with is Dart) || (with is FeatherVolume || with is Teleporter || this.removeFromLevel)) { return; } if (with is Duck) { Duck duck = with as Duck; duck.hSpeed += this.hSpeed * 1.1f; duck.vSpeed -= 3.3f; (with as Duck).GoRagdoll(); Event.Log((Event) new DartHitEvent(this.responsibleProfile, duck.profile)); if (duck.holdObject is Grenade) { duck.forceFire = true; } duck.Swear(); duck.ThrowItem(true); } ; this._stuck = true; Level.Remove((Thing)this); }