protected override void initParticle(EmissionInfo emission) { Particle particle = emission.Particle; particle.Pos = emission.StartPosition; particle.LastPos = particle.Pos; particle.ViewPos = particle.Pos; particle.MaxSpeed = AppMath.GetRandomNumber(minSpeed, maxSpeed); //700, 900 | (400, 600); //3, 8//Math->GetRandomNumber(510, 800); // 2000.0f if (!AppMath.Vec2IsZero(emission.EmitDirection)) { Vector2f particleDirection = AppMath.GetRandomVecBySpread(emission.EmitDirection, this.maxSpread); particle.Vel = new Vector2f(particleDirection.X * particle.MaxSpeed, particleDirection.Y * particle.MaxSpeed); } else { // float angle = (float)cAppMath.DegressToRadian(cAppMath.GetRandomNumber(0, 360));//sDivisions * m_Angles; particle.Vel = AppMath.GetRandomUnitVec() * particle.MaxSpeed; // particle.Vel = new Vector2f((float)Math.Cos(angle) * particle.MaxSpeed, (float)Math.Sin(angle) * particle.MaxSpeed); } //float dir = Math->GetRandomClamped(); //particle.m_Vel = sf::Vector2f(Math->GetRandomClamped() * particle.m_MaxSpeed, Math->GetRandomClamped() *particle.m_MaxSpeed); particle.SlowDown = slowDown; //0.92f; //particle.m_SlowDown = (float)Math->GetRandomDoubleInRange(0.55, 0.7); //0.6f; //phs->AddForce( sf::Vector2f(Math->GetRandomClamped() * phs->MaxSpeed, Math->GetRandomClamped() * phs->MaxSpeed) ); Vector2u uSize = this.renderStates.Texture.Size; particle.Scale = (float)AppMath.GetRandomDoubleInRange(this.minScale, this.maxScale); particle.Dims = new Vector2f(uSize.X * particle.Scale, uSize.Y * particle.Scale); particle.ScaleSpeed = -AppMath.GetRandomNumber(5, 20); //10.50 particle.Color = Utils.GetRandomBlueColor(); particle.Opacity = 255.0f; particle.Life = 1.0f; particle.Fade = 80; // 90; //Math->GetRandomNumber(100, 240); particle.Intersects = false; }
public override void Kill(cGameObject by) { this.Scene.LightMap.remove(this.p_followLight); this.Scene.LightMap.remove(this.eye); // this.spriteControl.ChangeState(new cSpriteState(MotionType.LIE, this.spriteControl.getCurrentState().HorizontalFacing)); this.health = 0; this.killed = true; // int y = AppRandom.Choose<int>(new[] { 1,-1}); this.Scene.QueueAction(() => { Vector2f emitDirection = AppMath.Vec2NormalizeReturn(by.Velocity); // new Vector2f(0.0f, y); float len = (float)AppMath.Vec2Length(this.Velocity); float speed = len > 1.0f ? len : 0.0f; ShakeScreen.Init(this.pscene.Camera.ActualPosition); ShakeScreen.StartShake(); Scene.Assets.PlaySound("blood_hit2", 25, this.position); //pscene.ParticleManager.Fireworks.NormalExplosion(new Particles.cEmissionInfo(this.Bounds.center, emitDirection)); var e = pscene.ParticleManager["explosions"] as cExplosionController; e.NormalBlood(new EmissionInfo(this.Bounds.center, emitDirection, speed)); e.Line(new EmissionInfo(this.Bounds.center, emitDirection)); this.Scene.QueueAction(() => { /* * if (this.IsOnGround) * { * this.Scene.Effects.PlaceGround(this.Bounds.center.X, this.Bounds.rightBottom.Y, "side-explosion1"); * } * else */ { this.Scene.Effects.Place(this.Bounds.center, "simple-explosion3"); // flash-black } // this.Scene.Effects.Place(intersection, "fire1"); }); // e.FastBlood(new EmissionInfo(this.Bounds.center,new Vector2f(0.0f, 0.0f))); //float gy = this.Bounds.rightBottom.Y; // ground y //pscene.Effects.PlaceGround(this.Bounds.center.X, gy, "side-explosion1"); //pscene.EntityPool.getEntitiesInRadius() // pscene.Effects.Place(this.bounds.center, "simple-explosion2"); } ); this.Scene.QueueAction(() => { Scene.Assets.PlaySound("coin_drop1", 20); ProbabilityRoll <int> numPickables = new ProbabilityRoll <int>(); numPickables.add(70, 2); numPickables.add(30, 3); int num = numPickables.roll(); for (int i = 0; i < num; ++i) { pscene.EntityPool.AddPickup( new cPickupAble( this.Scene, this.Bounds.center, AppMath.GetRandomUnitVec(), // emitDirection, PickupInfo.PickupType.COIN_GOLD) ); } }); /* * new platformerGame.GameCommands.comPlacePickup( * this.Scene, * new GameObjects.cPickupAble( * this.Scene, * this.Scene.EntityPool.SpatialGrid, * this.Bounds.center, * emitDirection) ) */ }