예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
        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)));
            }
        }
예제 #4
0
 public override void Update()
 {
     base.Update();
     if (!this.destroyed && !this._stuck)
     {
         if (!this.burning && Level.CheckCircle <SmallFire>(this.position, 8f) != null)
         {
             this.burning = true;
             this.onFire  = true;
             Level.Add((Thing)SmallFire.New(0.0f, 0.0f, 0.0f, 0.0f, stick: ((MaterialThing)this), firedFrom: ((Thing)this)));
             SFX.Play("ignite", Rando.Float(0.9f, 1f), Rando.Float(-0.2f, 0.2f));
         }
         this._sprite.frame = 0;
         this.angleDegrees  = -Maths.PointDirection(Vec2.Zero, new Vec2(this.hSpeed, this.vSpeed));
     }
     if (this._stuck)
     {
         this.vSpeed         = 0.0f;
         this.hSpeed         = 0.0f;
         this.grounded       = true;
         this._sprite.frame  = 1;
         this._stickTime    -= 0.01f;
         this.gravMultiplier = 0.0f;
     }
     if ((double)this._stickTime > 0.0 || this.destroyed)
     {
         return;
     }
     this.Destroy((DestroyType) new DTFade());
 }
예제 #5
0
 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();
 }
예제 #6
0
        public override void PopShell(float x, float y, int dir)
        {
            PistolShell pistolShell = new PistolShell(x, y);

            pistolShell.hSpeed = (float)dir * (1.5f + Rando.Float(1f));
            Level.Add((Thing)pistolShell);
        }
예제 #7
0
 public Dart(float xpos, float ypos, Duck owner, float fireAngle)
     : base(xpos, ypos)
 {
     this._sprite         = new SpriteMap("dart", 16, 16);
     this.graphic         = (Sprite)this._sprite;
     this.center          = new Vec2(8f, 8f);
     this.collisionOffset = new Vec2(-4f, -2f);
     this.collisionSize   = new Vec2(9f, 4f);
     this.depth           = new Depth(-0.5f);
     this.thickness       = 1f;
     this.weight          = 3f;
     this._owner          = owner;
     this.breakForce      = 1f;
     this._stickTime      = 2f + Rando.Float(0.8f);
     if ((double)Rando.Float(1f) > 0.949999988079071)
     {
         this._stickTime += Rando.Float(15f);
     }
     this.angle = fireAngle;
     if (owner == null)
     {
         return;
     }
     owner.clip.Add((MaterialThing)this);
     this.clip.Add((MaterialThing)owner);
 }
예제 #8
0
        public Confetti(float xpos, float ypos)
            : base(xpos, ypos)
        {
            int num = Rando.ChooseInt(0, 1, 2, 3);

            if (num == 0)
            {
                this._color = Color.Violet;
            }
            if (num == 1)
            {
                this._color = Color.SkyBlue;
            }
            if (num == 2)
            {
                this._color = Color.Wheat;
            }
            if (num == 4)
            {
                this._color = Color.GreenYellow;
            }
            this._sin   = new SinWave(0.01f + Rando.Float(0.03f), Rando.Float(7f));
            this._size  = 10f + Rando.Float(60f);
            this._speed = 0.8f + Rando.Float(1.4f);
            this.depth  = new Depth(0.95f);
        }
예제 #9
0
        public override void PopShell(float x, float y, int dir)
        {
            ShotgunShell shotgunShell = new ShotgunShell(x, y);

            shotgunShell.hSpeed = (float)dir * (1.5f + Rando.Float(1f));
            Level.Add((Thing)shotgunShell);
        }
예제 #10
0
        public MusketSmoke(float xpos, float ypos)
            : base(xpos, ypos)
        {
            this.xscale    = 0.15f + Rando.Float(0.15f);
            this.yscale    = this.xscale;
            this.angle     = Maths.DegToRad(Rando.Float(360f));
            this._fastGrow = 0.6f + Rando.Float(0.3f);
            this._angleInc = Maths.DegToRad(Rando.Float(2f) - 1f);
            this._scaleInc = 1f / 1000f + Rando.Float(1f / 1000f);
            this._fade     = 0.0015f + Rando.Float(1f / 1000f);
            this.move.x    = Rando.Float(0.2f) - 0.1f;
            this.move.y    = Rando.Float(0.2f) - 0.1f;
            GraphicList graphicList = new GraphicList();
            Sprite      graphic1    = new Sprite("smoke");

            graphic1.depth = new Depth(1f);
            graphic1.CenterOrigin();
            graphicList.Add(graphic1);
            Sprite graphic2 = new Sprite("smokeBack");

            graphic2.depth = new Depth(-0.1f);
            graphic2.CenterOrigin();
            graphicList.Add(graphic2);
            this.graphic          = (Sprite)graphicList;
            this.center           = new Vec2(0.0f, 0.0f);
            this.depth            = new Depth(1f);
            this._backgroundSmoke = new Sprite("smokeBack");
        }
예제 #11
0
        public override bool Hit(Bullet bullet, Vec2 hitPos)
        {
            if (_equippedDuck == null || bullet.owner == duck || !bullet.isLocal)
            {
                return(false);
            }

            var particleEnd =
                hitPos
                + (bullet.travelDirNormalized * bullet.bulletSpeed
                   * 3)
                + new Vec2(Rando.Float(-5f, 5f), Rando.Float(-5f, 5f));

            for (int i2 = 0; i2 < 3; i2++)
            {
                Level.Add(DotParticle.New(
                              hitPos.x + Rando.Float(-2f, 2f),
                              hitPos.y + Rando.Float(-2f, 2f),
                              () => particleEnd,
                              bullet.color.Add(new Color(
                                                   (byte)Rando.Int(-15, 15),
                                                   (byte)Rando.Int(-15, 15),
                                                   (byte)Rando.Int(-15, 15)
                                                   )),
                              0.2f));
            }
            SFX.Play("scimiSurge", 0.8f, Rando.Float(-0.2f, 0.2f));
            return(true);
        }
예제 #12
0
        public override void Removed()
        {
            base.Removed();
            ExplosionPart ins = new(travelEnd.x, travelEnd.y, true);

            Level.Add(ins);
            SFX.Play("explode", 0.7f, Rando.Float(-0.7f, -0.5f), 0f, false);
            Thing bulletOwner = owner;
            IEnumerable <MaterialThing> things = Level.CheckCircleAll <MaterialThing>(travelEnd, 16f);

            foreach (MaterialThing t2 in things)
            {
                if (t2 != bulletOwner && t2.owner != bulletOwner)
                {
                    t2.Destroy(new DTShot(this));
                }
            }
            var firedBullets = new List <Bullet>(7);

            for (int i = 0; i < 7; i++)
            {
                var bullet = Make.Bullet <AT_Lava>(travelEnd, _owner, Rando.Float(0, 360), this);
                firedBullets.Add(bullet);
                Level.Add(bullet);
            }
            if (Network.isActive)
            {
                NMFireGun gunEvent = new(null, firedBullets, (byte)firedBullets.Count, rel : false, 4);
                Send.Message(gunEvent, NetMessagePriority.ReliableOrdered);
                firedBullets.Clear();
            }
            SFX.Play("sizzle", 0.2f, Rando.Float(1, 4), 0f, false);
        }
예제 #13
0
        public override void PopShell(float x, float y, int dir)
        {
            MagnumShell magnumShell = new MagnumShell(x, y);

            magnumShell.hSpeed = (float)dir * (1.5f + Rando.Float(1f));
            Level.Add((Thing)magnumShell);
        }
예제 #14
0
 public override void Update()
 {
     this.timer -= 0.01f;
     if (timer <= 0 && !exploded)
     {
         exploded = true;
         float num1 = this.y - 2f;
         for (int index = 0; index < 20; ++index)
         {
             float      num2       = (float)((double)index * 18.0 - 5.0) + Rando.Float(10f);
             ATShrapnel atShrapnel = new ATShrapnel();
             atShrapnel.range = 60f + Rando.Float(18f);
             Bullet bullet = new Bullet(x + (float)(Math.Cos((double)Maths.DegToRad(num2)) * 6.0), num1 - (float)(Math.Sin((double)Maths.DegToRad(num2)) * 6.0), (AmmoType)atShrapnel, num2, (Thing)null, false, -1f, false, true);
             bullet.firedFrom = (Thing)this;
             Level.Add((Thing)bullet);
         }
         foreach (Window window in Level.CheckCircleAll <Window>(this.position, 40f))
         {
             if (Level.CheckLine <Block>(this.position, window.position, (Thing)window) == null)
             {
                 window.Destroy((DestroyType) new DTImpact((Thing)this));
             }
         }
     }
     if (exploded)
     {
         Level.Remove(this);
         Level.Remove(detonator);
     }
     if (this.owner as Duck != null)
     {
         var duck = (Duck)this.owner;
     }
     base.Update();
 }
        public override void BulletRemove()
        {
            NovaExp n = new(x, y, true);

            n.xscale *= 2.25f;
            n.yscale *= 2.25f;
            Level.Add(n);
            SFX.PlaySynchronized("explode", 0.8f, Rando.Float(-0.1f, 1f), 0f, false);
            if (isServerForObject)
            {
                IEnumerable <MaterialThing> things = Level.CheckCircleAll <MaterialThing>(position, 25f);
                foreach (MaterialThing t2 in things)
                {
                    if (t2 != BulletSafeDuck)
                    {
                        t2.Destroy(new DT_ThingBullet(this));
                    }
                }

                for (int i = 0; i < 6; i++)
                {
                    var bullet = new ArcaneNova_Magic_Stage3(position, GetBulletVecDeg(Rando.Float(0, 360), 6), BulletSafeDuck);
                    Level.Add(bullet);
                }
            }
            base.BulletRemove();
        }
        public ChallengeConfetti(float xpos, float ypos)
            : base(xpos, ypos)
        {
            SpriteMap spriteMap = new SpriteMap("arcade/confetti", 8, 8);

            spriteMap.AddAnimation("idle", 0.1f, true, 0, 1);
            spriteMap.SetAnimation("idle");
            this.graphic    = (Sprite)spriteMap;
            this._fallSpeed = Rando.Float(0.5f, 1.2f);
            this.layer      = Layer.HUD;
            int num = Rando.ChooseInt(0, 1, 2, 3);

            if (num == 0)
            {
                spriteMap.color = Color.Violet;
            }
            if (num == 1)
            {
                spriteMap.color = Color.SkyBlue;
            }
            if (num == 2)
            {
                spriteMap.color = Color.Wheat;
            }
            if (num == 4)
            {
                spriteMap.color = Color.GreenYellow;
            }
            this.depth = new Depth(1f);
        }
예제 #17
0
        public override bool Hit(Bullet bullet, Vec2 hitPos)
        {
            if (_equippedDuck == null || bullet.owner == duck || !bullet.isLocal)
            {
                return(false);
            }
            if (_isArmor && duck != null)
            {
                EquipmentHitPoints--;
                if (bullet.isLocal && EquipmentHitPoints <= 0)
                {
                    duck.KnockOffEquipment(this, ting: true, bullet);
                    Fondle(this, DuckNetwork.localConnection);
                }
                if (MakeDefaultHitEffects)
                {
                    if (bullet.isLocal && Network.isActive)
                    {
                        NetSoundEffect.Play("equipmentTing");
                    }
                    bullet.hitArmor = true;
                    Level.Add(MetalRebound.New(hitPos.x, hitPos.y, (bullet.travelDirNormalized.x > 0f) ? 1 : (-1)));
                    for (int i = 0; i < 6; i++)
                    {
                        Level.Add(Spark.New(x, y, bullet.travelDirNormalized));
                    }
                }
                return(BaseBaseHit());
            }
            return(BaseBaseHit());

            bool BaseBaseHit()
            {
                if (MakeDefaultHitEffects)
                {
                    if (physicsMaterial == PhysicsMaterial.Metal)
                    {
                        Level.Add(MetalRebound.New(hitPos.x, hitPos.y, (bullet.travelDirNormalized.x > 0f) ? 1 : (-1)));
                        hitPos -= bullet.travelDirNormalized;
                        for (int j = 0; j < 3; j++)
                        {
                            Level.Add(Spark.New(hitPos.x, hitPos.y, bullet.travelDirNormalized));
                        }
                    }
                    else if (physicsMaterial == PhysicsMaterial.Wood)
                    {
                        hitPos -= bullet.travelDirNormalized;
                        for (int i = 0; i < 3; i++)
                        {
                            WoodDebris woodDebris = WoodDebris.New(hitPos.x, hitPos.y);
                            woodDebris.hSpeed = 0f - bullet.travelDirNormalized.x + Rando.Float(-1f, 1f);
                            woodDebris.vSpeed = 0f - bullet.travelDirNormalized.y + Rando.Float(-1f, 1f);
                            Level.Add(woodDebris);
                        }
                    }
                }
                return(thickness > bullet.ammo.penetration);
            }
        }
예제 #18
0
        public override void Update()
        {
            var color = HSL.FromHslFloat(Rando.Float(0f, 1f), Rando.Float(0.7f, 1f), Rando.Float(0.45f, 0.65f));

            ammoType.bulletColor = color;
            _flare.color         = color;
            base.Update();
        }
 public override void Update()
 {
     base.Update();
     if (color == Color.White)
     {
         color = HSL.FromHslFloat(Rando.Float(0f, 1f), Rando.Float(0.7f, 1f), Rando.Float(0.45f, 0.65f));
     }
 }
예제 #20
0
 public override void MakeNetEffect(Vec2 pos, bool fromNetwork = false)
 {
     for (int index = 0; index < 1; index = index + 1 + 1)
     {
         Level.Add((Thing) new ExplosionPart(pos.x - 20f + Rando.Float(40f), pos.y - 20f + Rando.Float(40f)));
     }
     SFX.Play("explode");
 }
 public GlassParticle(float xpos, float ypos, Vec2 hitAngle, int tint = -1)
     : base(xpos, ypos)
 {
     this.hSpeed            = (float)(-(double)hitAngle.x * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929));
     this.vSpeed            = (float)(-(double)hitAngle.y * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929)) - Rando.Float(2f);
     this._bounceEfficiency = 0.6f;
     this._tint             = tint;
 }
예제 #22
0
        public static Vec2 GetBulletVecDeg(float degress, float speed = 1f, float speedVariable = 0, float accuracy = 1f)
        {
            var accuracyLossDeg = Rando.Float(180 * (1 - accuracy)).RandomNegative();
            var result          = Maths.AngleToVec(Maths.DegToRad(degress + accuracyLossDeg)) * (speed + Rando.Float(speedVariable).RandomNegative());

            result.y *= -1;
            return(result);
        }
예제 #23
0
 private void Init(float xpos, float ypos)
 {
     this.position.x        = xpos;
     this.position.y        = ypos;
     this.hSpeed            = -4f - Rando.Float(3f);
     this.vSpeed            = (float)-((double)Rando.Float(1.5f) + 1.0);
     this._sprite.frame     = Rando.Int(4);
     this._bounceEfficiency = 0.3f;
 }
예제 #24
0
    protected virtual void CreatePinParticle()
    {
        GrenadePin grenadePin = new GrenadePin(base.x, base.y);

        grenadePin.hSpeed = (float)(-offDir) * Rando.Float(1.5f, 2f);
        grenadePin.vSpeed = -2f;
        Level.Add(grenadePin);
        SFX.Play("pullPin");
    }
예제 #25
0
        protected override void CreatePinParticle()
        {
            Thing grenadePin = new EjectedCap(x, y);

            grenadePin.hSpeed = (float)(-offDir) * (1.5f + Rando.Float(0.5f));
            grenadePin.vSpeed = -2f;
            Level.Add(grenadePin);
            SFX.Play("pullPin");
        }
예제 #26
0
 public override void Explode()
 {
     Smoke();
     //SFX.Play(GetPath("sounds" + Path.DirectorySeparatorChar + "flashbang_csgo.wav"));
     //SFX.Play("explode", 1f, Rando.Float(-0.05f, 0.07f));
     SFX.Play(Mod.GetPath <IGHXY>("flashbang_csgo"), 1f, Rando.Float(-0.05f, 0.07f));
     Level.Remove(this);
     base.Explode();
 }
예제 #27
0
 public virtual void Smoke()
 {
     for (int i = 0; i < 300; ++i)
     {
         MusketSmoke musketSmoke = new MusketSmoke(this.x - 16f + Rando.Float(32f) + this.offDir * 10f, this.y - 16f + Rando.Float(32f));
         musketSmoke.depth = (Depth)((float)(.9f + (float)i * (1f / 1000f)));
         Level.Add((Thing)musketSmoke);
     }
 }
 public override void Removed()
 {
     NetHelper.NmFireGun(null, list =>
     {
         var bullet = Make.Bullet <AT_Leaf>(travelEnd, _owner, Rando.Float(0f, 360f), this);
         list.Add(bullet);
     });
     base.Removed();
 }
예제 #29
0
 public DizzyStar(float xpos, float ypos, Vec2 dir)
     : base(xpos, ypos)
 {
     this.graphic = new Sprite("dizzyStar");
     this.graphic.CenterOrigin();
     this.xscale  = this.yscale = Rando.Float(0.3f, 0.8f);
     this.hSpeed  = dir.x;
     this.vSpeed  = dir.y;
     this.maxSize = Rando.Float(0.4f, 1f);
 }
 public override void Removed()
 {
     base.Removed();
     for (int i = 0; i < 7; i++)
     {
         var b = new Oblivion_ThingBulletRedSmall(position, GetBulletVecDeg(Rando.Float(0, 360), 8), BulletSafeDuck);
         Level.Add(b);
         SFX.PlaySynchronized("laserBlast", 5, 1f);
     }
 }