Exemple #1
0
 protected override bool OnBurn(Vec2 firePosition, Thing litBy)
 {
     if (!this._onFire && (double)this.data.flammable > 0.5)
     {
         this._fireID = (float)FireManager.GetFireID();
         SFX.Play("ignite", pitch: (Rando.Float(0.3f) - 0.3f));
         this._onFire = true;
         this.alpha   = 1f;
     }
     return(true);
 }
Exemple #2
0
        public ExtinguisherSmoke(float xpos, float ypos, bool network = false)
            : base(xpos, ypos)
        {
            this.center               = new Vec2(8f, 8f);
            this.hSpeed               = Rando.Float(-0.2f, 0.2f);
            this.vSpeed               = Rando.Float(-0.2f, 0.2f);
            this._life               += Rando.Float(0.2f);
            this.angleDegrees         = Rando.Float(360f);
            this._gravMult            = 0.8f;
            this._sticky              = 0.2f;
            this._life                = 3f;
            this._bounceEfficiency    = 0.2f;
            this.xscale               = this.yscale = Rando.Float(0.4f, 0.5f);
            this._smokeID             = FireManager.GetFireID();
            this._collisionSize       = new Vec2(4f, 4f);
            this._collisionOffset     = new Vec2(-2f, -2f);
            this.needsSynchronization = true;
            this._sprite              = new SpriteMap("tinySmokeTestFront", 16, 16);
            int num1 = Rando.Int(3) * 4;

            this._sprite.AddAnimation("idle", 0.1f, true, num1);
            this._sprite.AddAnimation("puff", Rando.Float(0.15f, 0.25f), false, num1, 1 + num1, 2 + num1, 3 + num1);
            this._orbiter = new SpriteMap("tinySmokeTestFront", 16, 16);
            int num2 = Rando.Int(3) * 4;

            this._orbiter.AddAnimation("idle", 0.1f, true, num2);
            this._orbiter.AddAnimation("puff", Rando.Float(0.15f, 0.25f), false, num2, 1 + num2, 2 + num2, 3 + num2);
            this._sprite2 = new SpriteMap("tinySmokeTestBack", 16, 16);
            this.graphic  = (Sprite)this._sprite;
            this.center   = new Vec2(8f, 8f);
            if (Network.isActive && !network)
            {
                GhostManager.context.particleManager.AddLocalParticle((PhysicsParticle)this);
            }
            this.isLocal    = !network;
            this._orbitInc += 0.2f;
            this._sprite.SetAnimation("idle");
            this._sprite.angleDegrees  = Rando.Float(360f);
            this._orbiter.angleDegrees = Rando.Float(360f);
            this.s1 = Rando.Float(0.8f, 1.1f);
            this.s2 = Rando.Float(0.8f, 1.1f);
            float num3 = 0.6f - Rando.Float(0.2f);
            float num4 = 1f;

            this._sprite.color = new Color(num4, num4, num4);
            this.depth         = new Depth(0.8f);
            this.alpha         = 1f;
            this.layer         = Layer.Game;
            this.s1            = this.xscale;
            this.s2            = this.xscale;
        }