public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 16; ++index)
                {
                    Level.Add((Thing)SmallFire.New(c.x - 6f + Rando.Float(12f), c.y - 8f + Rando.Float(4f), Rando.Float(12f) - 6f, 2f - Rando.Float(8.5f), firedFrom: ((Thing)c)));
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
Пример #2
0
        private static SpawnPoint AttemptAnySpawn(
            Profile profile,
            List <SpawnPoint> usedSpawns,
            List <Duck> spawned)
        {
            List <SpawnPoint> spawnPointList = new List <SpawnPoint>();

            foreach (SpawnPoint spawnPoint in Level.current.things[typeof(SpawnPoint)])
            {
                if (!usedSpawns.Contains(spawnPoint))
                {
                    spawnPointList.Add(spawnPoint);
                }
            }
            if (spawnPointList.Count == 0)
            {
                if (usedSpawns.Count <= 0)
                {
                    return((SpawnPoint)null);
                }
                spawnPointList.AddRange((IEnumerable <SpawnPoint>)usedSpawns);
            }
            SpawnPoint spawnPoint1 = spawnPointList[Rando.Int(spawnPointList.Count - 1)];

            usedSpawns.Add(spawnPoint1);
            Duck duck = new Duck(spawnPoint1.x, spawnPoint1.y - 7f, profile);

            duck.offDir = spawnPoint1.offDir;
            spawned.Add(duck);
            return(spawnPoint1);
        }
Пример #3
0
        private static SpawnPoint AttemptCTFSpawn(
            Profile profile,
            List <SpawnPoint> usedSpawns,
            List <Duck> spawned,
            bool red)
        {
            int num = red ? 1 : 2;
            List <SpawnPoint> spawnPointList = new List <SpawnPoint>();

            foreach (FreeSpawn freeSpawn in Level.current.things[typeof(FreeSpawn)])
            {
                if (!usedSpawns.Contains((SpawnPoint)freeSpawn) && (int)freeSpawn.spawnType == num)
                {
                    spawnPointList.Add((SpawnPoint)freeSpawn);
                }
            }
            if (spawnPointList.Count == 0)
            {
                return((SpawnPoint)null);
            }
            SpawnPoint spawnPoint = spawnPointList[Rando.Int(spawnPointList.Count - 1)];

            usedSpawns.Add(spawnPoint);
            Duck duck = new Duck(spawnPoint.x, spawnPoint.y - 7f, profile);

            duck.offDir = spawnPoint.offDir;
            spawned.Add(duck);
            return(spawnPoint);
        }
Пример #4
0
        public void MakeBlowUpHappen(Vec2 pos)
        {
            if (this.blownUp)
            {
                return;
            }
            this.blownUp = true;
            SFX.Play("explode");
            Graphics.FlashScreen();
            float x = pos.x;
            float y = pos.y;

            Level.Add((Thing) new ExplosionPart(x, y));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, y - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
        }
Пример #5
0
        public void CreateExplosion(Vec2 pos)
        {
            if (this._explosionCreated)
            {
                return;
            }
            float x    = pos.x;
            float ypos = pos.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            this._explosionCreated = true;
            SFX.Play("explode");
        }
Пример #6
0
 public override void Update()
 {
     if (this._switchFrames > 0)
     {
         --this._switchFrames;
     }
     if (this._ruined)
     {
         if (this._cape != null)
         {
             Level.Remove((Thing)this._cape);
             this._cape = (Cape)null;
         }
         this.graphic = this._damaged;
         if ((double)this._ghostWait > 0.0)
         {
             this._ghostWait -= 0.4f;
         }
         else
         {
             if (!this._madeGhost)
             {
                 Level.Add((Thing) new EscapingGhost(this.x, this.y - 6f));
                 for (int index = 0; index < 8; ++index)
                 {
                     Level.Add((Thing)Spark.New(this.x + Rando.Float(-8f, 8f), this.y + Rando.Float(-8f, 8f), new Vec2(Rando.Float(-1f, 1f), Rando.Float(-1f, 1f))));
                 }
             }
             this._madeGhost = true;
         }
     }
     base.Update();
 }
Пример #7
0
 public CandleBall(float xpos, float ypos, FlareGun owner, int numFlames = 8)
     : base(xpos, ypos)
 {
     this._sprite = new SpriteMap("candleBall", 16, 16);
     this._sprite.AddAnimation("burn", (float)(0.400000005960464 + (double)Rando.Float(0.2f)), true, 0, 1);
     this._sprite.SetAnimation("burn");
     this._sprite.imageIndex = Rando.Int(4);
     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.9f);
     this.thickness      = 1f;
     this.weight         = 1f;
     this.breakForce     = 1E+08f;
     this._owner         = owner;
     this.weight         = 0.5f;
     this.gravMultiplier = 0.7f;
     this._numFlames     = numFlames;
     Color[] colorArray = new Color[4]
     {
         Color.Red,
         Color.Green,
         Color.Blue,
         Color.Orange
     };
     this._sprite.color = colorArray[Rando.Int(((IEnumerable <Color>)colorArray).Count <Color>() - 1)];
     this.xscale        = this.yscale = Rando.Float(0.4f, 0.8f);
 }
 public override bool Hit(Bullet bullet, Vec2 hitPos)
 {
     if ((double)this._hitPoints <= 0.0)
     {
         return(false);
     }
     hitPos += bullet.travelDirNormalized * 2f;
     if (1.0 - ((double)hitPos.y - (double)this.top) / ((double)this.bottom - (double)this.top) < (double)this._fluidLevel)
     {
         this.thickness = 2f;
         Vec2 off  = hitPos - this.position;
         bool flag = false;
         foreach (FluidStream hole in this._holes)
         {
             if ((double)(hole.offset - off).length < 2.0)
             {
                 hole.offset         = off;
                 hole.holeThickness += 0.5f;
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             this._holes.Add(new FluidStream(0.0f, 0.0f, (-bullet.travelDirNormalized).Rotate(Rando.Float(-0.2f, 0.2f), Vec2.Zero), 1f, off));
         }
         SFX.Play("bulletHitWater", pitch: Rando.Float(-0.2f, 0.2f));
         return(base.Hit(bullet, hitPos));
     }
     this.thickness = 1f;
     return(base.Hit(bullet, hitPos));
 }
Пример #9
0
        public SpaceDonut(float xpos, float ypos)
            : base(xpos, ypos)
        {
            Sprite sprite = new Sprite("background/donut");

            sprite.depth   = new Depth(-0.9f);
            this.graphic   = sprite;
            this._donuroid = new SpriteMap("background/donuroids", 32, 32);
            this._donuroid.CenterOrigin();
            Random random    = new Random(4562280);
            Random generator = Rando.generator;

            Rando.generator = random;
            Vec2 vec2_1 = new Vec2(-22f, -14f);
            Vec2 vec2_2 = new Vec2(130f, 120f);

            for (int index = 0; index < 20; ++index)
            {
                this._roids.Add(new Donuroid(vec2_2.x + Rando.Float(-6f, 6f), vec2_2.y + Rando.Float(-18f, 18f), this._donuroid, Rando.Int(0, 7), new Depth(1f), 1f));
                this._roids.Add(new Donuroid(vec2_2.x + Rando.Float(-6f, -1f), (float)((double)vec2_2.y + (double)Rando.Float(-10f, 0.0f) - 10.0), this._donuroid, Rando.Int(0, 7), this.depth - 20, 0.5f));
                this._roids.Add(new Donuroid(vec2_2.x + Rando.Float(6f, 1f), (float)((double)vec2_2.y + (double)Rando.Float(10f, 0.0f) - 10.0), this._donuroid, Rando.Int(0, 7), this.depth - 20, 0.5f));
                this._roids.Add(new Donuroid(vec2_2.x + Rando.Float(-6f, -1f), (float)((double)vec2_2.y + (double)Rando.Float(-10f, 0.0f) - 20.0), this._donuroid, Rando.Int(0, 7), this.depth - 30, 0.25f));
                this._roids.Add(new Donuroid(vec2_2.x + Rando.Float(6f, 1f), (float)((double)vec2_2.y + (double)Rando.Float(10f, 0.0f) - 20.0), this._donuroid, Rando.Int(0, 7), this.depth - 30, 0.25f));
                vec2_2   += vec2_1;
                vec2_1.y += 1.4f;
            }
            Rando.generator = generator;
        }
Пример #10
0
        public override void Draw()
        {
            float num1 = (float)Math.Sin((double)this._distPulse);
            float num2 = (float)-(Math.Sin((double)this._orbitInc) * (double)num1) * this.s1;
            float num3 = (float)Math.Cos((double)this._orbitInc) * num1 * this.s1;

            this._sprite.imageIndex = this._sprite.imageIndex;
            this._sprite.depth      = this.depth;
            this._sprite.scale      = new Vec2(this.s1);
            this._sprite.center     = this.center;
            Graphics.Draw((Sprite)this._sprite, this.x + num2, this.y + num3);
            this._sprite2.imageIndex = this._sprite.imageIndex;
            this._sprite2.angle      = this._sprite.angle;
            this._sprite2.depth      = new Depth(-0.5f);
            this._sprite2.scale      = this._sprite.scale;
            this._sprite2.center     = this.center;
            float num4 = 0.6f - Rando.Float(0.2f);
            float num5 = 0.4f;

            this._sprite2.color = new Color(num5, num5, num5);
            Graphics.Draw((Sprite)this._sprite2, this.x + num2, this.y + num3);
            this._orbiter.imageIndex = this._sprite.imageIndex;
            this._orbiter.color      = this._sprite.color;
            this._orbiter.depth      = this.depth;
            this._orbiter.scale      = new Vec2(this.s2);
            this._orbiter.center     = this.center;
            Graphics.Draw((Sprite)this._orbiter, this.x - num2, this.y - num3);
            this._sprite2.imageIndex = this._orbiter.imageIndex;
            this._sprite2.angle      = this._orbiter.angle;
            this._sprite2.depth      = new Depth(-0.5f);
            this._sprite2.scale      = this._orbiter.scale;
            this._sprite2.center     = this.center;
            this._sprite2.color      = new Color(num5, num5, num5);
            Graphics.Draw((Sprite)this._sprite2, this.x - num2, this.y - num3);
        }
        public override void Update()
        {
            if (this._prevPositions.Count == 0)
            {
                this._prevPositions.Insert(0, this.position);
            }
            Vec2             position         = this.position;
            ElectricalCharge electricalCharge = this;

            electricalCharge.position = electricalCharge.position + this._travelVec;
            this._travelVec           = new Vec2((float)this.offDir * Rando.Float(6f, 10f), Rando.Float(-10f, 10f));
            this._prevPositions.Insert(0, this.position);
            this.alpha -= 0.1f;
            if ((double)this.alpha < 0.0)
            {
                Level.Remove((Thing)this);
            }
            foreach (IAmADuck amAduck in Level.CheckLineAll <IAmADuck>(position, this.position))
            {
                if (amAduck is MaterialThing materialThing && amAduck != this.owner.owner)
                {
                    materialThing.Zap(this.owner);
                }
            }
            base.Update();
        }
Пример #12
0
        private static void FinishedTotalQuery(object sender)
        {
            WorkshopQueryAll workshopQueryAll = sender as WorkshopQueryAll;

            if (workshopQueryAll.numResultsTotal <= 0U)
            {
                return;
            }
            int num = Rando.Int((int)(workshopQueryAll.numResultsTotal / 50U)) + 1;

            if (RandomLevelDownloader.numSinceLowRating > 3)
            {
                RandomLevelDownloader.numSinceLowRating = 0;
            }
            else
            {
                num %= 10;
            }
            RandomLevelDownloader._orderMode = RandomLevelDownloader.numSinceLowRating != 2 ? WorkshopQueryFilterOrder.RankedByVote : WorkshopQueryFilterOrder.RankedByTrend;
            if (num == 0)
            {
                num = 1;
            }
            ++RandomLevelDownloader.numSinceLowRating;
            WorkshopQueryAll queryAll = Steam.CreateQueryAll(RandomLevelDownloader._orderMode, WorkshopType.Items);

            queryAll.requiredTags.Add("Deathmatch");
            queryAll.ResultFetched += new WorkshopQueryResultFetched(RandomLevelDownloader.Fetched);
            queryAll.page           = (uint)num;
            queryAll.justOnePage    = true;
            queryAll.Request();
        }
 public ElectricalCharge(float xpos, float ypos, int off, Thing own)
     : base(xpos, ypos)
 {
     this.offDir     = (sbyte)off;
     this._travelVec = new Vec2((float)this.offDir * Rando.Float(6f, 10f), Rando.Float(-10f, 10f));
     this.owner      = own;
 }
Пример #14
0
        public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 10; ++index)
                {
                    Mine  mine = new Mine(c.x, c.y);
                    float num2 = (float)index / 9f;
                    mine.hSpeed = (float)((double)num2 * 40.0 - 20.0) * Rando.Float(0.5f, 1f);
                    mine.vSpeed = Rando.Float(-3f, -11f);
                    mine.PressAction();
                    mine.Arm();
                    Level.Add((Thing)mine);
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
Пример #15
0
        // Token: 0x0600254F RID: 9551
        protected bool OnDestroybam(DestroyType type = null)
        {
            if (!base.isServerForObject)
            {
                return(false);
            }
            ATRCShrapnel shrap = new ATRCShrapnel();

            shrap.MakeNetEffect(this.position, false);
            List <Bullet> firedBullets = new List <Bullet>();

            for (int i = 0; i < 20; i++)
            {
                float dir = (float)i * 18f - 5f + Rando.Float(10f);
                shrap       = new ATRCShrapnel();
                shrap.range = 55f + Rando.Float(14f);
                Bullet bullet = new Bullet(base.x + (float)(Math.Cos((double)Maths.DegToRad(dir)) * 6.0), base.y - (float)(Math.Sin((double)Maths.DegToRad(dir)) * 6.0), shrap, dir, null, false, -1f, false, true);
                bullet.firedFrom = this;
                firedBullets.Add(bullet);
                Level.Add(bullet);
            }
            if (Network.isActive)
            {
                Send.Message(new NMFireGun(null, firedBullets, 0, false, 4, false), NetMessagePriority.ReliableOrdered, null);
                firedBullets.Clear();
            }
            Level.Remove(this);
            return(true);
        }
        public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 18; ++index)
                {
                    float  deg  = (float)index * 22.5f;
                    double num2 = (double)Rando.Float(8f, 14f);
                    Level.Add((Thing) new QuadLaserBullet(c.x, c.y, new Vec2((float)Math.Cos((double)Maths.DegToRad(deg)), (float)-Math.Sin((double)Maths.DegToRad(deg)))));
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
Пример #17
0
        public override void HeatUp(Vec2 location)
        {
            this._hitPoints -= 0.016f;
            if ((double)this._hitPoints < 0.0500000007450581)
            {
                Level.Remove((Thing)this);
                for (int index = 0; index < 16; ++index)
                {
                    FluidData water = Fluid.Water;
                    water.amount = 3f / 1000f;
                    Fluid fluid = new Fluid(this.x, this.y, Vec2.Zero, water);
                    fluid.hSpeed = (float)((double)index / 16.0 - 0.5) * Rando.Float(0.3f, 0.4f);
                    fluid.vSpeed = Rando.Float(-1.5f, 0.5f);
                    Level.Add((Thing)fluid);
                }
            }
            FluidData water1 = Fluid.Water;

            water1.amount = 0.004f;
            Fluid fluid1 = new Fluid(this.x, this.y, Vec2.Zero, water1);

            fluid1.hSpeed = Rando.Float(-0.1f, 0.1f);
            fluid1.vSpeed = Rando.Float(-0.3f, 0.3f);
            Level.Add((Thing)fluid1);
            base.HeatUp(location);
        }
Пример #18
0
        public override void Activate(DeathCrate c, bool server = true)
        {
            float x    = c.x;
            float ypos = c.y - 2f;

            Level.Add((Thing) new ExplosionPart(x, ypos));
            int num1 = 6;

            if (Graphics.effectsLevel < 2)
            {
                num1 = 3;
            }
            for (int index = 0; index < num1; ++index)
            {
                float deg  = (float)index * 60f + Rando.Float(-10f, 10f);
                float num2 = Rando.Float(12f, 20f);
                Level.Add((Thing) new ExplosionPart(x + (float)Math.Cos((double)Maths.DegToRad(deg)) * num2, ypos - (float)Math.Sin((double)Maths.DegToRad(deg)) * num2));
            }
            if (server)
            {
                for (int index = 0; index < 8; ++index)
                {
                    Sword sword = new Sword(c.x, c.y);
                    float num2  = (float)index / 7f;
                    sword.hSpeed          = (float)((double)num2 * 30.0 - 15.0) * Rando.Float(0.5f, 1f);
                    sword.vSpeed          = Rando.Float(-10f, 10f);
                    sword._wasLifted      = true;
                    sword._framesExisting = 16;
                    Level.Add((Thing)sword);
                }
                Level.Remove((Thing)c);
            }
            Graphics.FlashScreen();
            SFX.Play("explode");
        }
Пример #19
0
        protected override bool OnDestroy(DestroyType type = null)
        {
            this._hitPoints = 0.0f;
            Level.Remove((Thing)this);
            SFX.Play("glassHit");
            Vec2 hitAngle = Vec2.Zero;

            if (type is DTShot)
            {
                hitAngle = (type as DTShot).bullet.travelDirNormalized;
            }
            for (int index = 0; index < 8; ++index)
            {
                Thing thing = (Thing) new GlassParticle(this.x + Rando.Float(-4f, 4f), this.y + Rando.Float(-4f, 4f), hitAngle);
                Level.Add(thing);
                thing.hSpeed = (float)((double)hitAngle.x * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929));
                thing.vSpeed = (float)((double)hitAngle.y * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929)) - Rando.Float(2f);
                Level.Add(thing);
            }
            for (int index = 0; index < 5; ++index)
            {
                SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-6f, 6f), this.y + Rando.Float(-6f, 6f));
                smallSmoke.hSpeed += Rando.Float(-0.3f, 0.3f);
                smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                Level.Add((Thing)smallSmoke);
            }
            return(true);
        }
Пример #20
0
        public override void Initialize()
        {
            List <System.Type> physicsObjects = ItemBox.GetPhysicsObjects(Editor.Placeables);

            physicsObjects.RemoveAll((Predicate <System.Type>)(t => t == typeof(Present) || t == typeof(LavaBarrel) || t == typeof(Grapple)));
            this._contains = physicsObjects[Rando.Int(physicsObjects.Count - 1)];
        }
Пример #21
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);
        }
Пример #22
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();
 }
Пример #23
0
        protected override bool OnDestroy(DestroyType type = null)
        {
            this._hitPoints = 0.0f;
            Level.Remove((Thing)this);
            SFX.Play("crateDestroy");
            Vec2 vec2 = Vec2.Zero;

            if (type is DTShot)
            {
                vec2 = (type as DTShot).bullet.travelDirNormalized;
            }
            for (int index = 0; index < 6; ++index)
            {
                Thing thing = (Thing)WoodDebris.New(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f));
                thing.hSpeed = (float)(((double)Rando.Float(1f) > 0.5 ? 1.0 : -1.0) * (double)Rando.Float(3f) + (double)Math.Sign(vec2.x) * 0.5);
                thing.vSpeed = -Rando.Float(1f);
                Level.Add(thing);
            }
            for (int index = 0; index < 5; ++index)
            {
                SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-6f, 6f), this.y + Rando.Float(-6f, 6f));
                smallSmoke.hSpeed += Rando.Float(-0.3f, 0.3f);
                smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                Level.Add((Thing)smallSmoke);
            }
            return(true);
        }
Пример #24
0
 public override void Update()
 {
     base.Update();
     this._life        = 1f;
     this.angleDegrees = this._spinAngle;
     if ((bool)this._sparkTimer)
     {
         Level.Add((Thing)Spark.New(this.x, this.y - 2f, new Vec2(Rando.Float(-1f, 1f), -0.5f), 0.1f));
     }
     if (!(bool)this._explodeTimer)
     {
         return;
     }
     SFX.Play("littleGun", Rando.Float(0.8f, 1f), Rando.Float(-0.5f, 0.5f));
     for (int index = 0; index < 8; ++index)
     {
         float      num        = (float)((double)index * 45.0 - 5.0) + Rando.Float(10f);
         ATShrapnel atShrapnel = new ATShrapnel();
         atShrapnel.range = 8f + Rando.Float(3f);
         Level.Add((Thing) new Bullet(this.x + (float)(Math.Cos((double)Maths.DegToRad(num)) * 6.0), this.y - (float)(Math.Sin((double)Maths.DegToRad(num)) * 6.0), (AmmoType)atShrapnel, num)
         {
             firedFrom = (Thing)this
         });
     }
     Level.Add((Thing)SmallSmoke.New(this.x, this.y));
     if ((double)Rando.Float(1f) < 0.100000001490116)
     {
         Level.Add((Thing)SmallFire.New(this.x, this.y, 0.0f, 0.0f, firedFrom: ((Thing)this)));
     }
     Level.Remove((Thing)this);
 }
Пример #25
0
        public static System.Type PickType(int chanceGroup, List <TypeProbPair> contains)
        {
            ItemBox.GetPhysicsObjects(Editor.Placeables);
            Random random    = new Random((int)((double)Level.GetChanceGroup2(chanceGroup) * 2147483648.0 - 1.0));
            Random generator = Rando.generator;

            Rando.generator = random;
            IOrderedEnumerable <TypeProbPair> orderedEnumerable = contains.OrderBy <TypeProbPair, float>((Func <TypeProbPair, float>)(x => Rando.Float(1f)));

            System.Type type = (System.Type)null;
            float       num  = 0.0f;

            foreach (TypeProbPair typeProbPair in (IEnumerable <TypeProbPair>)orderedEnumerable)
            {
                if ((double)Rando.Float(1f) > 1.0 - (double)typeProbPair.probability)
                {
                    type = typeProbPair.type;
                    break;
                }
                if ((double)typeProbPair.probability > (double)num)
                {
                    num  = typeProbPair.probability;
                    type = typeProbPair.type;
                }
            }
            Rando.generator = generator;
            return(type);
        }
Пример #26
0
 protected override bool OnDestroy(DestroyType type = null)
 {
     if (this._duckOwner == null)
     {
         return(false);
     }
     if (!this.destroyed)
     {
         this._duckOwner.hSpeed = this.hSpeed;
         bool wasKilled = type != null;
         if (!wasKilled && this.jumpCountdown > 0.01f)
         {
             this._duckOwner.vSpeed = Duck.JumpSpeed;
         }
         else
         {
             this._duckOwner.vSpeed = (wasKilled ? (this.vSpeed - 1f) : -3f);
         }
         this._duckOwner.x = base.x;
         this._duckOwner.y = base.y - 10f;
         for (int i = 0; i < 4; i++)
         {
             SmallSmoke s = SmallSmoke.New(base.x + Rando.Float(-4f, 4f), base.y + Rando.Float(-4f, 4f));
             s.hSpeed += this.hSpeed * Rando.Float(0.3f, 0.5f);
             s.vSpeed -= Rando.Float(0.1f, 0.2f);
             Level.Add(s);
         }
         if (this.owner != null)
         {
             Duck d = this.owner as Duck;
             if (d != null)
             {
                 d.holdObject = null;
             }
         }
         if (Network.isActive)
         {
             if (!wasKilled)
             {
                 this._duckOwner.Fondle(this);
                 this.authority += 45;
             }
             this.active  = false;
             this.visible = false;
             this.owner   = null;
         }
         else
         {
             Level.Remove(this);
         }
         if (wasKilled && !this._duckOwner.killingNet)
         {
             this._duckOwner.killingNet = true;
             this._duckOwner.Destroy(type);
         }
         this._duckOwner._trapped = null;
     }
     return(true);
 }
Пример #27
0
        public override void Initialize()
        {
            Layer.HUD.camera.size *= 4f;
            int          num1          = 19;
            int          num2          = 3;
            TourneyGroup tourneyGroup1 = new TourneyGroup();
            int          num3          = 0;

            foreach (Team p in Teams.allRandomized)
            {
                tourneyGroup1.AddPlayer(p, true);
                if (tourneyGroup1.players.Count == num2)
                {
                    this._groups.Add(tourneyGroup1);
                    tourneyGroup1            = new TourneyGroup();
                    tourneyGroup1.groupIndex = this._groups.Count;
                }
                ++num3;
                if (num3 == num1)
                {
                    break;
                }
            }
            if (tourneyGroup1.players.Count > 0)
            {
                this._groups.Add(tourneyGroup1);
            }
            List <TourneyGroup> tourneyGroupList1 = this._groups;
            List <TourneyGroup> tourneyGroupList2 = new List <TourneyGroup>();
            int num4 = 1;

            while (tourneyGroupList1.Count > 1)
            {
                int          num5          = 0;
                TourneyGroup tourneyGroup2 = (TourneyGroup)null;
                foreach (TourneyGroup tourneyGroup3 in tourneyGroupList1)
                {
                    if (tourneyGroup2 == null)
                    {
                        num5                     = 0;
                        tourneyGroup2            = new TourneyGroup();
                        tourneyGroup2.groupIndex = tourneyGroupList2.Count;
                        tourneyGroup2.depth      = num4;
                        tourneyGroupList2.Add(tourneyGroup2);
                    }
                    tourneyGroup3.next = tourneyGroup2;
                    tourneyGroup3.next.AddPlayer(tourneyGroup3.players[Rando.Int(tourneyGroup3.players.Count - 1)]);
                    ++num5;
                    if (num5 == num2)
                    {
                        tourneyGroup2 = (TourneyGroup)null;
                    }
                }
                ++num4;
                tourneyGroupList1 = tourneyGroupList2;
                tourneyGroupList2 = new List <TourneyGroup>();
            }
            base.Initialize();
        }
Пример #28
0
 protected override string OnGetLocalName()
 {
     if (this._localName == "")
     {
         this._localName = "test " + Rando.Int(235645).ToString();
     }
     return(this._localName);
 }
Пример #29
0
 public LevelUpArrowAnimation(Vec2 pos)
     : base(pos, new SpriteMap("levelUpArrow", 16, 16), 0.9f)
 {
     this.layer         = Layer.HUD;
     this.alpha         = 0.0f;
     this._startWait    = Rando.Float(2.5f);
     this._sprite.depth = new Depth(1f);
 }
Пример #30
0
 public T2 GetRandom(T group)
 {
     if (this._items.ContainsKey(group))
     {
         return(this._items[group][Rando.Int(this._items[group].Count - 1)]);
     }
     return(this._globalItems.Count > 0 ? this._globalItems[Rando.Int(this._globalItems.Count - 1)] : default(T2));
 }