// 延迟实例预制
    IEnumerator InstantiateDelayed( ExplosionPart go  )
    {
        if (go.hqOnly && QualityManager.quality < Quality.High)
            yield return 0;

        yield return new WaitForSeconds (go.delay);
        Instantiate (go.gameObject, transform.position + Vector3.up * go.yOffset, transform.rotation);
    }
Beispiel #2
0
    // 延迟实例预制
    IEnumerator InstantiateDelayed(ExplosionPart go)
    {
        if (go.hqOnly && QualityManager.quality < Quality.High)
        {
            yield return(0);
        }

        yield return(new WaitForSeconds(go.delay));

        Instantiate(go.gameObject, transform.position + Vector3.up * go.yOffset, transform.rotation);
    }
 public override void MakeNetEffect(Vec2 pos, bool fromNetwork = false)
 {
     for (int index = 0; index < 1; ++index)
     {
         ExplosionPart explosionPart = new ExplosionPart(pos.x - 8f + Rando.Float(16f), pos.y - 8f + Rando.Float(16f));
         explosionPart.xscale *= 0.7f;
         explosionPart.yscale *= 0.7f;
         Level.Add((Thing)explosionPart);
     }
     SFX.Play("explode");
 }
Beispiel #4
0
        public static void Create(Thing owner, Vec2 pos, Config cfg)
        {
            if (cfg.Flash)
            {
                Graphics.FlashScreen();
            }

            float x = pos.x;
            float y = pos.y - 2f;

            Level.Add(new ExplosionPart(x, y));

            int amount = Rando.Int(1, 2);

            for (int i = 0; i < amount; i++)
            {
                float deg   = (float)i * 360f / amount + Rando.Float(-10f, 10f);
                float rad   = Maths.DegToRad(deg);
                float range = Rando.Float(12f, 20f);

                float xDir = (float)Math.Cos(rad);
                float yDir = (float)Math.Sin(rad);

                ExplosionPart thing = new ExplosionPart(x + xDir * range, y - yDir * range);
                Level.Add(thing);
            }

            for (int i = 0; i < 20; i++)
            {
                float deg = (float)i * 18f - 5f + Rando.Float(10f);
                float rad = Maths.DegToRad(deg);

                float xDir = (float)Math.Cos(rad);
                float yDir = (float)Math.Sin(rad);

                Bullet bullet = new Bullet(x + xDir * 6, y - yDir * 6, cfg.AmmoType.Invoke(), deg);
                bullet.firedFrom = owner;
                Level.Add(bullet);
            }

            SFX.Play(cfg.Sound);
        }
Beispiel #5
0
 public void CreateExplosion(Vec2 pos)
 {
     if (!this._explosionCreated)
     {
         float cx = pos.x;
         float cy = pos.y - 2f;
         Level.Add(new ExplosionPart(cx, cy, true));
         int num = 6;
         if (Graphics.effectsLevel < 2)
         {
             num = 3;
         }
         for (int i = 0; i < num; i++)
         {
             float         dir  = (float)i * 60f + Rando.Float(-10f, 10f);
             float         dist = Rando.Float(12f, 20f);
             ExplosionPart ins  = new ExplosionPart(cx + (float)(System.Math.Cos((double)Maths.DegToRad(dir)) * (double)dist), cy - (float)(System.Math.Sin((double)Maths.DegToRad(dir)) * (double)dist), true);
             Level.Add(ins);
         }
         this._explosionCreated = true;
         SFX.Play("explode", 0.7f, 0f, 0f, false);
     }
 }
Beispiel #6
0
 public Explosion(ExplosionPart part)
 {
     Sprite = new Sprite(AssetManager.Textures["explosion"], 64, 64, (int)part, 6);
     Sprite.Loop = false;
     ZIndex = 3;
 }
 public override IEnumerator InstantiateDelayed(ExplosionPart go)
 {
     return(new $InstantiateDelayed$78(go, this).GetEnumerator());
 }