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);
 }
Example #2
0
 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;
     }
 }
Example #3
0
 public override void OnImpact(MaterialThing with, ImpactedFrom from)
 {
     if (!this._pin && with is Duck)
     {
         this._timer = 0.01f;
     }
 }
Example #4
0
        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._inGun || !(with is Block))
     {
         return;
     }
     this._stuck = true;
 }
Example #6
0
 public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (!HasPin)
     {
         // Have it stop on boxes and other props
     }
     base.OnSoftImpact(with, from);
 }
Example #7
0
 // Token: 0x06000CC8 RID: 3272
 public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (this._wasLifted && this.owner == null && with is Block)
     {
         this.Shing();
         this._framesSinceThrown = 15;
     }
 }
 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 (!HasPin)
     {
         Explode();
     }
     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);
 }
Example #11
0
        public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
        {
            if (from == ImpactedFrom.Bottom && (double)this.hitWait == 0.0 && with.isServerForObject)
            {
                with.Fondle((Thing)this);
            }
            if (!this.isServerForObject || from != ImpactedFrom.Bottom || (double)this.hitWait != 0.0)
            {
                return;
            }
            this.hitWait = 1f;
            switch (with)
            {
            case Holdable holdable when holdable.lastThrownBy != null || holdable is RagdollPart && !Network.isActive:
                Duck lastThrownBy = holdable.lastThrownBy as Duck;
                if (holdable is RagdollPart)
                {
                    break;
                }
                if (lastThrownBy != null)
                {
                    PurpleBlock.StoreItem(lastThrownBy.profile, (Thing)with);
                }
                this.Bounce();
                break;

            case Duck duck:
                StoredItem storedItem = PurpleBlock.GetStoredItem(duck.profile);
                if (storedItem.type != (System.Type)null && !this._served.Contains(duck.profile))
                {
                    this.contains      = storedItem.type;
                    this._contextThing = storedItem.thing;
                    this.Pop();
                    this._hit = false;
                    this._served.Add(duck.profile);
                }
                else
                {
                    if (this._served.Contains(duck.profile))
                    {
                        SFX.Play("scanFail");
                    }
                    this.Bounce();
                }
                if (duck.holdObject == null)
                {
                    break;
                }
                Holdable holdObject = duck.holdObject;
                if (holdObject == null)
                {
                    break;
                }
                PurpleBlock.StoreItem(duck.profile, (Thing)holdObject);
                break;
            }
        }
Example #12
0
 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);
 }
Example #13
0
 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 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);
 }
Example #15
0
 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);
                     }
                 }
             }
         }
     }
 }
Example #16
0
 // Token: 0x06002309 RID: 8969
 public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (this.owner == null && with is Block)
     {
         this.Shing(with);
         if (base.totalImpactPower > 3f)
         {
             this._started = false;
         }
     }
 }
Example #17
0
 public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (!(with is IPlatform))
     {
         return;
     }
     for (int index = 0; index < 4; ++index)
     {
         Level.Add((Thing)Spark.New(this.barrelPosition.x + Rando.Float(-6f, 6f), this.barrelPosition.y + Rando.Float(-3f, 3f), -MaterialThing.ImpactVector(from)));
     }
 }
        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);
        }
Example #19
0
        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);
        }
Example #20
0
 public override void OnSolidImpact(MaterialThing with, ImpactedFrom from)
 {
     if (!HasPin)
     {
         Explode();
     }
     if (pullOnImpact)
     {
         OnPressAction();
     }
     base.OnSolidImpact(with, from);
 }
Example #21
0
 public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (this._fade || with is Gun || (with is AutoPlatform || with is Nubber) && (double)this.vSpeed <= 0.0)
     {
         return;
     }
     if (with is PhysicsObject)
     {
         this._isVolatile = -1f;
     }
     if ((double)this._startWait <= 0.0 && !this._fade && ((double)this.totalImpactPower > 2.0 && ((double)this._isVolatile <= 0.0 || !(with is Block)) || this._blowUp))
     {
         int num1 = 0;
         for (int index = 0; index < 1; ++index)
         {
             ExplosionPart explosionPart = new ExplosionPart(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f));
             explosionPart.xscale *= 0.7f;
             explosionPart.yscale *= 0.7f;
             Level.Add((Thing)explosionPart);
             ++num1;
         }
         SFX.Play("explode");
         for (int index = 0; index < 12; ++index)
         {
             float      num2       = (float)((double)index * 30.0 - 10.0) + Rando.Float(20f);
             ATShrapnel atShrapnel = new ATShrapnel();
             atShrapnel.range = 25f + Rando.Float(10f);
             Level.Add((Thing) new Bullet(this.x + (float)(Math.Cos((double)Maths.DegToRad(num2)) * 8.0), this.y - (float)(Math.Sin((double)Maths.DegToRad(num2)) * 8.0), (AmmoType)atShrapnel, num2)
             {
                 firedFrom = (Thing)this
             });
         }
         this._fade = true;
         this.y    += 10000f;
     }
     else
     {
         if (with is IPlatform)
         {
             return;
         }
         if (from == ImpactedFrom.Left || from == ImpactedFrom.Right)
         {
             this.BounceH();
         }
         if (from != ImpactedFrom.Top && from != ImpactedFrom.Bottom)
         {
             return;
         }
         this.BounceV();
     }
 }
 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 OnSolidImpact(MaterialThing with, ImpactedFrom from)
 {
     with.Fondle((Thing)this);
     if (from == ImpactedFrom.Top && (double)with.totalImpactPower + (double)this.totalImpactPower > 0.100000001490116 && this._sprite.currentAnimation == "idle")
     {
         this.activated = true;
         this._sprite.SetAnimation("activate");
         SFX.Play("click");
         this.collisionOffset = new Vec2(-8f, -8f);
         this.collisionSize   = new Vec2(16f, 15f);
     }
     base.OnSolidImpact(with, from);
 }
Example #24
0
        public override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
        {
            if (Network.isActive && this.connection != DuckNetwork.localConnection)
            {
                return;
            }
            switch (with)
            {
            case Duck duck when !duck.inNet && !duck.dead:
                duck.Netted(this);
                if (duck._trapped != null)
                {
                    for (int index = 0; index < 4; ++index)
                    {
                        SmallSmoke smallSmoke = SmallSmoke.New(duck._trapped.x + Rando.Float(-4f, 4f), duck._trapped.y + Rando.Float(-4f, 4f));
                        smallSmoke.hSpeed += duck._trapped.hSpeed * Rando.Float(0.3f, 0.5f);
                        smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                        Level.Add((Thing)smallSmoke);
                    }
                }
                if (Recorder.currentRecording == null)
                {
                    break;
                }
                Recorder.currentRecording.LogBonus();
                break;

            case RagdollPart ragdollPart when ragdollPart.doll.captureDuck != null && !ragdollPart.doll.captureDuck.dead:
                Duck captureDuck = ragdollPart.doll.captureDuck;
                this.Fondle((Thing)ragdollPart.doll);
                ragdollPart.doll.Unragdoll();
                captureDuck.Netted(this);
                if (captureDuck._trapped != null)
                {
                    for (int index = 0; index < 4; ++index)
                    {
                        SmallSmoke smallSmoke = SmallSmoke.New(captureDuck._trapped.x + Rando.Float(-4f, 4f), captureDuck._trapped.y + Rando.Float(-4f, 4f));
                        smallSmoke.hSpeed += captureDuck._trapped.hSpeed * Rando.Float(0.3f, 0.5f);
                        smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                        Level.Add((Thing)smallSmoke);
                    }
                }
                if (Recorder.currentRecording == null)
                {
                    break;
                }
                Recorder.currentRecording.LogBonus();
                break;
            }
        }
 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);
 }
Example #26
0
        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 override void OnSoftImpact(MaterialThing with, ImpactedFrom from)
 {
     if (this._isMace && with is Duck)
     {
         if (with == this.collar.owner || (double)this.totalImpactPower <= 8.0)
         {
             return;
         }
         with.Destroy((DestroyType) new DTCrush((PhysicsObject)this));
     }
     else
     {
         base.OnSoftImpact(with, from);
     }
 }
Example #28
0
 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;
     }
 }
Example #29
0
        public static Vec2 ImpactVector(ImpactedFrom from)
        {
            switch (from)
            {
            case ImpactedFrom.Left:
                return(new Vec2(-1f, 0.0f));

            case ImpactedFrom.Right:
                return(new Vec2(1f, 0.0f));

            case ImpactedFrom.Top:
                return(new Vec2(0.0f, -1f));

            default:
                return(new Vec2(0.0f, 1f));
            }
        }
Example #30
0
 public Spikes(float xpos, float ypos)
     : base(xpos, ypos)
 {
     this._sprite            = new SpriteMap("spikes", 16, 19);
     this._sprite.speed      = 0.1f;
     this.graphic            = (Sprite)this._sprite;
     this.center             = new Vec2(8f, 14f);
     this.collisionOffset    = new Vec2(-8f, -5f);
     this.collisionSize      = new Vec2(16f, 7f);
     this.depth              = new Depth(0.36f);
     this._editorName        = "Spikes Up";
     this.thickness          = 100f;
     this.physicsMaterial    = PhysicsMaterial.Metal;
     this.editorOffset       = new Vec2(0.0f, 6f);
     this.hugWalls           = WallHug.Floor;
     this._editorImageCenter = true;
     this._killImpact        = ImpactedFrom.Top;
 }