IEnumerator bomb(System.Random rand) { Debug.Log("bomb gogogo"); yield return(new WaitForEndOfFrame()); for (float d = 0.1f; d > 0.01f; d -= 0.04f) { var forceVector = new Vector3(d, 0, 0); for (int i = 0; i < 10; i++) { var dest = Quaternion.AngleAxis(i * 36f, Vector3.up) * forceVector; var smoke = Instantiate(smokeBombPrefab, transform.position, Quaternion.identity) as GameObject; SmokeParticles sp = smoke.GetComponent <SmokeParticles>(); sp.Setup(rand, dest, 1); } yield return(new WaitForFixedUpdate()); } while (true) { var forceVector = new Vector3((float)rand.NextDouble() * 0.03f + 0.04f, 0, 0); float i = (float)rand.NextDouble() * 360f; var dest = Quaternion.AngleAxis(i, Vector3.up) * forceVector; var smoke = Instantiate(smokeBombPrefab, transform.position, Quaternion.identity) as GameObject; SmokeParticles sp = smoke.GetComponent <SmokeParticles>(); sp.Setup(rand, dest, 0); yield return(new WaitForSeconds(0.5f)); } }
private void UpdateWind() { var speed = WindSpeedSlider.value; var angle = WindDirectionSlider.value; Vector2 v = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)); //print("----------- v:"+v); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { var a = WindStrengthMultiplier * Vector2.Dot(_windMatrixVectors[i, j], v); //get angle WindMatrix[i, j] = WindBaseMatrix[i, j] + a * speed; if (WindMatrix[i, j] < 0) { WindMatrix[i, j] = 0; } } //print( WindMatrix[i,0].ToString("0.00")+"|"+WindMatrix[i,1].ToString("0.00")+"|"+WindMatrix[i,2].ToString("0.00")); } Forest.WindChanged(WindMatrix); SmokeParticles.SetWindSpeed(-WindStrengthMultiplier * speed * v); }
public void Update(GameTime gameTime) { StarFactory.Update(gameTime, _tunnel, Scene, _player); BombFactory.Update(gameTime, _tunnel, Scene, _player); ExplosionParticles.Update(gameTime); FireParticles.Update(gameTime); SmokeParticles.Update(gameTime); StarsParticles.Update(gameTime); }
public void DrawParticles(GameTime gametime) { SmokeParticles.SetCamera(_camera.View, _camera.Projection); SmokeParticles.Draw(gametime); ExplosionParticles.SetCamera(_camera.View, _camera.Projection); ExplosionParticles.Draw(gametime); FireParticles.SetCamera(_camera.View, _camera.Projection); FireParticles.Draw(gametime); StarsParticles.SetCamera(_camera.View, _camera.Projection); StarsParticles.Draw(gametime); }
public void Update(GameTime gameTime) { StarFactory.Update(gameTime, _tunnel, Scene, _player); BombFactory.Update(gameTime, _tunnel, Scene, _player); // Log the position for the analysis LoopGame.Instance.GameObjects.TryUpdate("PlayerPosition", new Vector3(_player.Angle, Globals.Lives, Globals.TotalScore)); ExplosionParticles.Update(gameTime); FireParticles.Update(gameTime); SmokeParticles.Update(gameTime); StarsParticles.Update(gameTime); }
public override void PostInitialize() { bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue; FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true; base.PostInitialize(); if (mSpriteInstance.Parent == null) { mSpriteInstance.CopyAbsoluteToRelative(); mSpriteInstance.AttachTo(this, false); } base.SpriteInstance.Texture = Stage2; base.SpriteInstance.LeftTexturePixel = 3f; base.SpriteInstance.RightTexturePixel = 142f; base.SpriteInstance.TopTexturePixel = 373f; base.SpriteInstance.BottomTexturePixel = 760f; base.SpriteInstance.TextureScale = 0.5f; base.SpriteInstance.UseAnimationRelativePosition = true; base.SpriteInstance.AnimationChains = Rabbit2Animations; base.SpriteInstance.CurrentChainName = "Running"; base.SpriteInstance.IgnoreAnimationChainTextureFlip = true; if (mCircleInstance.Parent == null) { mCircleInstance.CopyAbsoluteToRelative(); mCircleInstance.AttachTo(this, false); } base.CircleInstance.Radius = 16f; if (LightSprite.Parent == null) { LightSprite.CopyAbsoluteToRelative(); LightSprite.AttachTo(this, false); } base.LightSprite.Texture = AllAssetsSheet; base.LightSprite.LeftTexturePixel = 1792f; base.LightSprite.RightTexturePixel = 2048f; base.LightSprite.TopTexturePixel = 1792f; base.LightSprite.BottomTexturePixel = 2048f; base.LightSprite.TextureScale = 0.5f; if (ShadowSprite.Parent == null) { ShadowSprite.CopyAbsoluteToRelative(); ShadowSprite.AttachTo(this, false); } if (ShadowSprite.Parent == null) { base.ShadowSprite.Y = -32f; } else { base.ShadowSprite.RelativeY = -32f; } if (ShadowSprite.Parent == null) { base.ShadowSprite.Z = -1f; } else { base.ShadowSprite.RelativeZ = -1f; } base.ShadowSprite.Texture = AllParticles; base.ShadowSprite.LeftTexturePixel = 1019f; base.ShadowSprite.RightTexturePixel = 1072f; base.ShadowSprite.TopTexturePixel = 1895f; base.ShadowSprite.BottomTexturePixel = 1948f; base.ShadowSprite.TextureScale = 1f; base.ShadowSprite.Width = 48f; base.ShadowSprite.Height = 16f; #if FRB_MDX ShadowSprite.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Modulate; #else base.ShadowSprite.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate; #endif base.ShadowSprite.Alpha = 0.3f; if (PoisonedParticles.Parent == null) { PoisonedParticles.CopyAbsoluteToRelative(); PoisonedParticles.AttachTo(this, false); } if (FrozenParticles.Parent == null) { FrozenParticles.CopyAbsoluteToRelative(); FrozenParticles.AttachTo(this, false); } if (SmokeParticles.Parent == null) { SmokeParticles.CopyAbsoluteToRelative(); SmokeParticles.AttachTo(this, false); } if (StunParticles.Parent == null) { StunParticles.CopyAbsoluteToRelative(); StunParticles.AttachTo(this, false); } mGeneratedCollision = new FlatRedBall.Math.Geometry.ShapeCollection(); mGeneratedCollision.Circles.AddOneWay(mCircleInstance); FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd; }