private void CreateCoinParticles() { StandardGameHUD hud = owner.HUD as StandardGameHUD; if (hud == null) { return; } double forceMult = COIN_EXPLOSIONFRAGMENTS_FORCE / (Math.Sqrt(width * width + height * height) / 2.0); double w = width / COIN_EXPLOSIONFRAGMENTS_X; double h = height / COIN_EXPLOSIONFRAGMENTS_Y; for (int y = 0; y < COIN_EXPLOSIONFRAGMENTS_Y; y++) { for (int x = 0; x < COIN_EXPLOSIONFRAGMENTS_X; x++) { owner.AddEntity( new CoinExplosionParticle( this, x, y, COIN_EXPLOSIONFRAGMENTS_X, COIN_EXPLOSIONFRAGMENTS_Y, forceMult + (random.NextDouble() * 6 - 3), hud), position.X + x * w, position.Y + y * h); } } }
public HUDHeadExplosionController(HUDHeadExplosionParticle e, Vec2d spawnForce, StandardGameHUD pHud, OffsetCalculator pOffset) : base(e) { hud = pHud; movementDelta = spawnForce; target = pHud.GetHeadTarget(); offset = pOffset; }
public override void Init(AbstractMarioPower p, HUDModel hmod) { base.Init(p, hmod); if (hmod == null) { HUD = new StandardGameHUD(this); } else { HUD = hmod; } LoadMapFromResources(p); }
public HUDHeadExplosionParticle(GameWorld owner, int texX, int texY, int fullTextW, int fullTextH, double forceMult, StandardGameHUD hud) : base(Textures.texture_mariohead, Block.BLOCK_WIDTH, Block.BLOCK_HEIGHT, texX, texY, fullTextW, fullTextH) { SetLifetime(STANDARD_LIFETIME); SetFadetime(STANDARD_FADETIME); Vec2d force = new Vec2d(texX - fullTextW / 2, texY - fullTextH / 2); force *= forceMult; AddController(new HUDHeadExplosionController(this, force, hud, owner.offset)); }
public CoinExplosionParticle(CoinEntity c, int texX, int texY, int fullTextW, int fullTextH, double forceMult, StandardGameHUD hud) : base(c, texX, texY, fullTextW, fullTextH) { SetLifetime(STANDARD_LIFETIME); SetFadetime(STANDARD_FADETIME); Vec2d force = new Vec2d(texX - fullTextW / 2, texY - fullTextH / 2); force *= forceMult; AddController(new CoinExplosionController(this, force, hud, (c.owner as GameWorld).offset)); }