protected void GetHit(bool isRight, float damage, bool doKnockback) { if (state == State.Dead) { return; } health -= damage; if (health <= 0) { if (state != State.Dead) { SetDead(isRight, this.GetType()); } target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType()); } else { if (!doKnockback) { SetStaggered(isRight); } else { SetKnockedBack(isRight); } } soundManager.PlayOneShot(getHitSound); cameraController.Shake(damage); ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right); }
void FixedUpdate() { if (!flying) { return; } if (target == null) { Destroy(gameObject); } else { if (Vector3.Distance(transform.position, target.transform.position) <= speed * Time.deltaTime) { if (clip != null) { AudioManager.instance.PlaySound(clip); } if (ps != null) { ParticleEffectManager.CreateParticleEffect(ps, this.transform.position, Camera.main.transform); } target.HitBy(this); } else { //this.transform.position += new Vector3(1, 0, 0) * speed * Time.deltaTime; this.transform.position += (target.transform.position - this.transform.position).normalized * speed * Time.deltaTime; } } }
//Particle Effects public void RegisterParticleEffect(ParticleEffectManager particleEffect) { if (!ParticleEffects.Contains(particleEffect)) { ParticleEffects.Add(particleEffect); } }
public KinectRagdollGame() { Main = this; graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = WIDTH; graphics.PreferredBackBufferHeight = HEIGHT; Content.RootDirectory = "Content"; FarseerTextures.Init(); FarseerTextures.SetGame(this); kinectManager = new KinectManager(); farseerManager = new FarseerManager(true, this); ragdollManager = new RagdollManager(); actionCenter = new ActionCenter(this); inputManager = new InputManager(this); //spriteHelper = new SpriteHelper(); objectiveManager = new ObjectiveManager(this); powerupManager = new PowerupManager(ragdollManager, farseerManager); jukebox = new Jukebox(); hazardManager = new HazardManager(farseerManager, ragdollManager); particleEffectManager = new ParticleEffectManager(graphics, ref farseerProjection); toolbox = new Toolbox(this); this.IsMouseVisible = true; bkColor = Color.CornflowerBlue; }
/// <summary> /// Hits the player /// </summary> /// <param name="damage">the amount of damage to deal</param> /// <param name="knockBackDirection">set to 1 if attack came from right of PC, -1 if from left, leave 0 if no knockback</param> public void GetHit(float damage, int knockBackDirection = 0, bool dealRawDamage = false) { if (!dealRawDamage) { float damageReduction = 1 - (0.052f * Armor) / (0.9f + 0.048f * Armor); health -= damage * damageReduction; } else { health -= damage; } if (knockBackDirection == 2) { playerMovement.KnockbackUp(damage); } else if (knockBackDirection != 0) { playerMovement.KnockBack(knockBackDirection == 1, damage); } if (health <= 0) { Die(); } statusGUI.UpdateHealthbar(); soundController.PlayGetHitSound(); cameraController.Shake(damage); ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, playerMovement.capsColl.bounds.center, knockBackDirection == 1 ? Vector3.left : knockBackDirection == -1 ? Vector3.right : Vector3.zero); }
public void DeleteEnemy(EnemyScript es) { //金币奖励 mapController.gameObject.GetComponent <StageController>().gold += es.reward; TextEffectManager.instance.ShowTextAtPosition("+" + es.reward, enemyGoldColor, 25, es.transform.position + new Vector3(0, 0.5f), 0.3f); int id = es.ID; Vector3 pos = es.transform.position; //有复活标记并且是被打死的才能复活 bool rs = es.resurrect && es.hp <= 0 && !es.cursed; //秋穰子收获 for (int i = 0; i < turretController.list_minoriko.Count; i++) { MinorikoScript ms = turretController.list_minoriko[i]; if (ms.InFireRange(es.transform)) { float rate; if (ms.level == 0) { rate = 0.6f; } else { rate = 1f; } ms.Gain(rate * (float)es.reward); } } //结算蕾蒂的冰爆效果 if (PlayerInfo.instance.assist == Utils.ASSIST_LETTY) { if (es.HasDebuff(21)) { foreach (EnemyScript enemy in enemyList) { if (enemy != es && Vector3.Distance(es.transform.position, enemy.transform.position) <= 2) { enemy.HitBy(es.maxHp / 10, 0, 21, 1); } } } } enemyList.Remove(es); Destroy(es.gameObject); //如果能复活 if (rs) { EnemyScript newes = CreateEnemy(id, pos).GetComponent <EnemyScript>(); newes.resurrect = false; newes.SetHP(es.maxHp * es.resurrectRatio, es.maxHp * es.resurrectRatio); ParticleEffectManager.ShowResurrectEffect(pos + new Vector3(0, -0.5f), newes.transform); } }
public void Update(GameTime gameTime) { rainFrequencyS -= (float)gameTime.ElapsedGameTime.TotalSeconds; lightningFrequency -= (float)gameTime.ElapsedGameTime.TotalSeconds; foliages.RemoveAll(f => !f.Active); if (rainFrequencyS <= 0) { if (currentRainEffectManager != null) { scene.RemoveParticleEffect(currentRainEffectManager); } CreateRainEffect(); scene.RegisterParticleEffect(currentRainEffectManager); rainFrequencyS = currentRainEffectManager.EffectDuration / 1000 + 60 + random.Next(30); } if (currentRainEffectManager != null && currentRainEffectManager.EffectDuration <= 0) { IsRaining = false; //scene.RemoveParticleEffect(currentRainEffectManager); //currentRainEffectManager = null; /*if (currentFogEffectManager == null) * { * CreateFogEffect(); * scene.RegisterParticleEffect(currentFogEffectManager); * }*/ } else if (currentRainEffectManager != null && currentRainEffectManager.EffectDuration > 0) { IsRaining = true; } /*if(currentFogEffectManager == null) * { * CreateFogEffect(); * scene.RegisterParticleEffect(currentFogEffectManager); * }*/ if (currentFogEffectManager != null && currentFogEffectManager.EffectDuration <= 0) { scene.RemoveParticleEffect(currentFogEffectManager); currentFogEffectManager = null; } if (lightningFrequency <= 0) { if (IsRaining) { CreateLightningEffect(); scene.MatchSoundManager.PlaySoundEffect(SoundEffectEnumeration.Thunder); } lightningFrequency = 10 + random.Next(10); } }
public void Start() { instance = this; foreach (var p in particleEffects) { p.particleSystem = Instantiate(p.prefab, transform).GetComponent <ParticleSystem>(); p.particleSystem.Stop(); } }
// Update is called once per frame void Update() { AudioManager AM = AudioManager.Instance; ParticleEffectManager PM = ParticleEffectManager.Instance; if (AM != null && PM != null) { Destroy(gameObject); } }
/// <summary>C:\Users\John Getty\Desktop\MPE\ParticleTextures\Particle001.png /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { _renderer =new BillboardRenderer {GraphicsDeviceService = _graphics}; var colors = new[] { Color.Pink.ToVector3(), Color.Yellow.ToVector3(), Color.Lavender.ToVector3(), Color.Salmon.ToVector3() }; _manager = new ParticleEffectManager(_renderer); for (int i = 0; i < 4; i++) { _emitters[i] = new SphereEmitter { Radius = 10, Radiate = true, Budget = 16384, ReleaseColour = colors[i], ReleaseQuantity = 50/(i+1), BlendMode = EmitterBlendMode.Add, ReleaseSpeed = .2f * (4-i), ReleaseOpacity = .1f, ReleaseScale = (i+1) * 5 *.02f, Term = 1, }; if (i==1) { _emitters[i].Modifiers.Add(new LinearGravityModifier { Gravity = new Vector3(-2, -2, 0) }); _emitters[i].Modifiers.Add(new OpacityModifier {Initial = 0.2f, Ultimate = 0f}); } if (i==2) { _emitters[i].Modifiers.Add(new LinearGravityModifier { Gravity = new Vector3(1, -1, 0) }); _emitters[i].Modifiers.Add(new ColourModifier { InitialColour = Color.Red.ToVector3(), UltimateColour = Color.White.ToVector3() }); _emitters[i].Modifiers.Add(new OpacityModifier {Initial = 0.4f, Ultimate = 0f}); } } _effect = new ParticleEffect { _emitters[0], _emitters[1], _emitters[2], _emitters[3] }; _effect.Initialise(); _manager.Add(_effect); _projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, _graphics.GraphicsDevice.Viewport.AspectRatio, 1f, 500f); base.Initialize(); }
void Start() { horizontal = 0; canMove = true; canJump = true; MapStateFunctions(); player = GetComponent <Rigidbody2D>(); defaultMaxSpeed = speed; ChangeState(MovementState.GROUND); PEM = GameObject.FindGameObjectWithTag("Particles Manager").GetComponent <ParticleEffectManager>(); }
// Use this for initialization void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
private void Awake() { AudioManager AM = AudioManager.Instance; ParticleEffectManager PM = ParticleEffectManager.Instance; if (AM != null && PM != null) { Destroy(gameObject); } //AM.PlayLoop(AudioManager.Sounds.BKG_LOOP); }
private void CreateFogEffect() { Rectangle emitterLocation = scene.ShopKeeperStartPos[1 + random.Next(scene.ShopKeeperStartPos.Count - 1)]; int duration = 10000 + random.Next(20000); currentFogEffectFactory = new FogParticleEffectFactory(FogParticleEffectType.Default, new Vector2(emitterLocation.X + emitterLocation.Width, emitterLocation.Y - emitterLocation.Height / 4), 50, duration); currentFogEffectManager = new ParticleEffectManager(new List <RenderObject>() { new Sprite(ParticleConfig.WHITE_CIRCLE) }, currentFogEffectFactory, 2, 32, false, BlendState.NonPremultiplied, effectDuration: duration); }
protected void GetHit(bool isRight, float damage, bool doKnockback) { if (state == State.Dead) { return; } health -= damage; if (health <= 0) { SetDead(isRight, this.GetType()); StopAllCoroutines(); animator.SetBool("Shout", false); animator.SetBool("Charging", false); animator.SetBool("Stunned", false); soundManager.StopPlayingBossMusic(); bossHealthbar.Hide(); bossArena.OpenGate1(); bossArena.OpenGate2(); Player p = target.GetComponent <Player>(); p.hubSaveState.UnlockHubPortal(2); p.hubSaveState.UnlockHubPortal(3); p.hubSaveState.UnlockHubSmithNpc(); p.hubSaveState.UnlockEssenceCollector(); p.AddEnemyKilledToCount(this.GetType()); FindObjectOfType <GameManager>().SaveGame(true); } else { bool stagger = false; if (doKnockback || staggerCounter + 1 <= maxStaggerCount) { stagger = true; } if (stagger) { staggerCounter += 1; SetStaggered(isRight); } else if (staggerCounter + 1 >= maxStaggerCount) { ShoutAttack(); } } bossHealthbar.UpdateHealthbar(health, maxHealth); sound.PlayOneShot(getHitSound); cameraController.Shake(damage); ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right); }
public override void UseSkill() { ParticleEffectManager.ShowResurrectAuraEffect(transform.position, transform); foreach (EnemyScript es in enemyList) { if (!es.resurrect && es.ID != this.enemy.ID) { if (Vector3.Distance(es.transform.position, this.transform.position) < range) { es.resurrect = true; es.resurrectRatio = this.hpRatio; } } } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } //register particle GCManager.RegisterObject(SMALL_BLAST_GC_KYE, smallBlast); GCManager.RegisterObject(Large_BLAST_GC_KYE, largeBlast); GCManager.RegisterObject(RED_CIRCLE_HINT_GC_KEY, red_circle); }
public override void execute(List <object> actuator, List <object> target) { controller.Possess(character); scene.Characters.Add(character); scene.GetActors().Add(character); scene.AddAiController(controller); Vector3 position = character.GetCenterPosition(); Vector3 size = character.GetSize(); //Show grass particle effects when the character appears FoliageCutParticleEffectFactory foliageCutFactory = new FoliageCutParticleEffectFactory(new Vector2(position.X, position.Y + 20), (int)size.Length(), 600, new Vector2(0.8f, 1.3f), new Vector2(-0.5f, -1.5f) /*Vector2.Zero*/, 1f, 0f, Color.ForestGreen, Color.Brown, 400, rotVel: 0.75f); ParticleEffectManager foliageCutEffectManager = new ParticleEffectManager(ParticleConfig.FOLIAGE_CUT_TEXTURE, foliageCutFactory, 30, 200, false, BlendState.NonPremultiplied, effectDuration: 600); scene.ParticleEffects.Add(foliageCutEffectManager); }
protected void GetHit(bool isRight, float damage) { if (state == State.Dead) { return; } health -= damage; if (health <= 0) { StopAllCoroutines(); nagaManager.EnrageFemaleNaga(); SetDead(isRight, this.GetType(), 0); nagaManager.Died(false); animator.SetBool("IsChannellingWhirlwind", false); animator.SetBool("IsWindingUpWhirlwind", false); this.enabled = false; nagaManager.HideHealthbar(false); if (spawnedWhirlwindObject != null) { spawnedWhirlwindObject.GetComponent <NagaKingWhirlwindEffect>().Stop(); } target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType()); } else { bool stagger = false; if (staggerCounter + 1 <= maxStaggerCount) { stagger = true; } if (stagger) { staggerCounter += 1; SetStaggered(isRight); } nagaManager.UpdateHealthbar(false, health, maxHealth); } sound.PlayOneShot(getHitSound); cameraController.Shake(damage); ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right); }
private void DespawnAi() { Path.Clear(); scene.RemoveActor(Character()); scene.Characters.Remove(Character()); scene.RemoveAiController(this); //Remove footstep particle effect for the current Ai scene.RemoveParticleEffect(Character().CharacterPhysics.FootstepEffectManager); //Show particle effects if AI disappears Vector3 position = Character().GetCenterPosition(); Vector3 size = Character().GetSize(); FoliageCutParticleEffectFactory foliageCutFactory = new FoliageCutParticleEffectFactory(new Vector2(position.X, position.Y + 20), (int)size.Length(), 600, new Vector2(0.8f, 1.3f), new Vector2(-0.5f, -10f) /*Vector2.Zero*/, 1f, 0f, Color.ForestGreen, Color.Brown, 400, rotVel: 0.75f); ParticleEffectManager foliageCutEffectManager = new ParticleEffectManager(ParticleConfig.FOLIAGE_CUT_TEXTURE, foliageCutFactory, 30, 200, false, BlendState.NonPremultiplied, effectDuration: 600); scene.ParticleEffects.Add(foliageCutEffectManager); }
private void CreateRainEffect() { var duration = 10000 + random.Next(20000); var rainDir = random.Next(1, 4);//1 <= rainDir < 4 if (rainDir == 2) { rainDir = 0; } var rot = (float)(rainDir * Math.PI) / 4; var maxVelX = GetMaxVelX(rot); var newParticleAmount = newParticleAmounts[random.Next(newParticleAmounts.Length)]; heavyRain = newParticleAmount > 20; currentRainEffectFactory = new RainParticleEffectFactory(RainParticleEffectType.Default, new Vector2(baseScreenSize.X / 2, -5), 20, baseScreenSize, maxVelX, rot: rot); currentRainEffectManager = new ParticleEffectManager(new List <RenderObject>() { new Sprite(ParticleConfig.RAIN_DROP) }, currentRainEffectFactory, newParticleAmount, 16, false, BlendState.NonPremultiplied, effectDuration: duration, baseScreenSize: baseScreenSize); }
protected void GetHit(bool isRight, float damage) { if (state == State.Dead || !canTakeDamage) { return; } health -= damage; if (health <= 0) { StopAllCoroutines(); SetDead(isRight, this.GetType()); nagaManager.Died(true); nagaManager.StopPlayingBossMusic(); nagaManager.HideHealthbar(true); target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType()); } Teleport(); nagaManager.UpdateHealthbar(true, health, maxHealth); sound.PlayOneShot(getHitSound); cameraController.Shake(damage); ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right); }
public override void UseSkill() { if (enemyList != null) { ParticleEffectManager.ShowHealEffect(this.transform.position + new Vector3(0, 0.5f), this.transform); if (aoe) { foreach (EnemyScript ec in enemyList) { if (Vector3.Distance(ec.transform.position, this.transform.position) <= range) { Heal(ec); } } } else { Heal(enemy); } } }
public void CharacterCut(Character actuatingCharacter) { if (!Active) { return; } Active = false; CharacterCutEventList.Execute(new List <object>() { actuatingCharacter }, new List <object>() { this }); //show particle effect FoliageCutParticleEffectFactory foliageCutFactory = new FoliageCutParticleEffectFactory(new Vector2(position.X, position.Y - size.Y / 2), (int)size.Length(), 500, new Vector2(5, 5), Vector2.Zero, 1f, 0f, Color.White, Color.White, 500, rotVel: 2f); ParticleEffectManager foliageCutEffectManager = new ParticleEffectManager(ParticleConfig.FOLIAGE_CUT_TEXTURE, foliageCutFactory, 1, 128, false, BlendState.NonPremultiplied, effectDuration: 500); scene.ParticleEffects.Add(foliageCutEffectManager); }
public void StartBurning() { Vector3 centerPos = GetCenterPosition(); float endPosY; if (Moving) { endPosY = centerPos.Y; } else { endPosY = centerPos.Y - size.Y; } //ParticleEffectFactory fireParticleEffectFactory = new FireParticleEffectFactory(FireParticleEffectType.Default, new Vector2(centerPos.X, centerPos.Y), (int)size.Length()); ParticleEffectFactory fireParticleEffectFactory = new FireParticleEffectFactory(new Vector2(centerPos.X, endPosY), 3, 2000, new Vector2(0.3f, 0f), new Vector2(60f, 400), 0.35f, -0.2f, Color.Red, Color.Yellow, 1750, 0.9f); ParticleEffectManager fireParticleEffectManager = new ParticleEffectManager(new List <RenderObject>() { new Sprite(ParticleConfig.WHITE_CIRCLE) }, fireParticleEffectFactory, 5, 16, false, BlendState.Additive, effectDuration: 5000); scene.RegisterParticleEffect(fireParticleEffectManager); burnDuration = fireParticleEffectManager.EffectDuration + 100; }
protected void GetHit(bool isRight, float damage) { if (state == State.Dead) { return; } health -= damage; if (health <= 0) { StopAllCoroutines(); nagaManager.EnrageMaleNaga(); SetDead(isRight, this.GetType(), 0); nagaManager.Died(true); nagaManager.HideHealthbar(true); this.enabled = false; target.GetComponent <Player>().AddEnemyKilledToCount(this.GetType()); } else { bool stagger = false; if (staggerCounter + 1 <= maxStaggerCount) { stagger = true; } if (stagger) { staggerCounter += 1; SetStaggered(isRight); } nagaManager.UpdateHealthbar(true, health, maxHealth); } sound.PlayOneShot(getHitSound); cameraController.Shake(damage); ParticleEffectManager.PlayEffect(ParticleEffect.Type.blood, coll.bounds.center, isRight ? Vector3.left : Vector3.right); }
public CharacterPhysics(Character character, Vector3 characterPosition, Vector3 characterSize, Rectangle hitboxOffset, Scene scene) { this.character = (DefaultCharacter)character; initPosition = characterPosition; position = initPosition; this.hitboxOffset = hitboxOffset; BoundingBox = new Rectangle((int)(characterPosition.X + hitboxOffset.X), (int)(characterPosition.Y + hitboxOffset.Y), hitboxOffset.Width + 5, hitboxOffset.Height); this.scene = scene; touchedActors = new List <Actor>(); Projectiles = new List <Projectile>(); InitMovementFields(); rayCastResult = new CollidableResults(); insideClimbingArea = new CollidableResults(); //Init Particle effects for footsteps footstepEffectFactory = new FootstepParticleEffectFactory(new Vector2(BoundingBox.Left, BoundingBox.Bottom), 20, 250, Vector2.Zero, Vector2.Zero, 1f, 0.7f, Color.White, Color.White, 250); FootstepEffectManager = new ParticleEffectManager(ParticleConfig.FOOTSTEP_TEXTURE, footstepEffectFactory, 1, 128, true, BlendState.NonPremultiplied) { Paused = true }; scene.ParticleEffects.Add(FootstepEffectManager); Player currentPlayer = character.GetPosession() as Player; if (currentPlayer != null) { playerIndex = (int)currentPlayer.playerIndex; } }
public void Initialize(Game game) { particleEngine = new ParticleEffectManager(new SpriteBatchRenderer()); particleEngine.Renderer.GraphicsDeviceService = game.Services.GetService(typeof(IGraphicsDeviceService)) as IGraphicsDeviceService; particleEngine.Renderer.LoadContent(game.Content); }
public void RemoveParticleEffect(ParticleEffectManager particleEffect) { ParticleEffects.Remove(particleEffect); }
public ParticleEffectManager() { instance = this; }
private void Awake() { instance = this; pool = new Stack <GameObject>(); }
/// <summary> /// Initializes a new instance of the <see cref="GravitySensor"/> class. /// </summary> /// <param name="world">The World object.</param> /// <param name="debugViewXNA">The DebugViewXNA object.</param> /// <param name="content">The ContentManager object.</param> /// <param name="graphics">The GraphicsDeviceManager object.</param> /// <param name="position">The initial position of the sensor.</param> /// <param name="radius">The radius of the sensor's shape.</param> /// <param name="density">The density of the sensor.</param> /// <param name="strength">The gravity strength of the sensor.</param> /// <param name="minRadius">The minimum radius the gravity can affect.</param> /// <param name="maxRadius">The maximum radius the gravity can affect.</param> /// <param name="effect">The ParticleEffect for the sensor.</param> /// <param name="screenManager">The ScreenManager object.</param> public GravitySensor(World world, DebugViewXNA debugViewXNA, ContentManager content, GraphicsDeviceManager graphics, Vector2 position, float radius, float density, float strength, float minRadius, float maxRadius, ParticleEffect effect, ScreenManager.ScreenManager screenManager ) : base(world, debugViewXNA, content, graphics, position, radius, density, strength, minRadius, maxRadius) { this.mParticleEffect = effect; this.mParticleRenderer = new SpriteBatchRenderer { GraphicsDeviceService = this.mGraphics }; this.mParticleManager = new ParticleEffectManager(this.mParticleRenderer); this.mParticleManager.Add(this.mParticleEffect); this.mParticleEffect.LoadContent(this.mContent); this.mParticleEffect.Initialise(); this.mParticleRenderer.LoadContent(this.mContent); this.mParticleEnabled = true; this.mWorld.ContactManager.BeginContact += BeginContact; this.mWorld.ContactManager.EndContact += EndContact; this.mInfo = new SensorInfoText(this.mContent, this.mGraphics, ConvertUnits.ToDisplayUnits(this.mPosition), Color.White); }
void Start() { hookBody = GetComponent<Rigidbody2D>(); hookBody.AddForce(transform.rotation * Vector2.right * hookSpeed, ForceMode2D.Impulse); partManag = GameObject.FindGameObjectWithTag("Particles Manager").GetComponent<ParticleEffectManager>(); }
/// <summary> /// Initializes a new instance of the <see cref="GravitySensor"/> class. /// </summary> /// <param name="world">The World object.</param> /// <param name="debugViewXNA">The DebugViewXNA object.</param> /// <param name="content">The ContentManager object.</param> /// <param name="graphics">The GraphicsDeviceManager object.</param> /// <param name="position">The initial position of the sensor.</param> /// <param name="radius">The radius of the sensor's shape.</param> /// <param name="density">The density of the sensor.</param> /// <param name="strength">The gravity strength of the sensor.</param> /// <param name="minRadius">The minimum radius the gravity can affect.</param> /// <param name="maxRadius">The maximum radius the gravity can affect.</param> /// <param name="effect">The ParticleEffect for the sensor.</param> /// <param name="screenManager">The ScreenManager object.</param> public GravitySensor(World world, DebugViewXNA debugViewXNA, ContentManager content, GraphicsDeviceManager graphics, Vector2 position, float radius, float density, float strength, float minRadius, float maxRadius, ScreenManager.ScreenManager screenManager ) : base(world, debugViewXNA, content, graphics, position, radius, density, strength, minRadius, maxRadius) { this.mParticleRenderer = new SpriteBatchRenderer { GraphicsDeviceService = this.mGraphics }; this.mParticleManager = new ParticleEffectManager(this.mParticleRenderer); this.mEmitter = new CircleEmitter { Radius = this.mRadius, Ring = true, Radiate = true, Budget = 500, ReleaseColour = new VariableFloat3 { Value = new Vector3(0, 1, 1), Variation = new Vector3(0, 0, 0) }, ReleaseQuantity = 4, ReleaseImpulse = new Vector2(0, 0), ReleaseOpacity = new VariableFloat { Value = 1f, Variation = 0f }, ReleaseRotation = new VariableFloat { Value = 3.14f, Variation = 3.14f }, ReleaseSpeed = new VariableFloat { Value = 50f, Variation = 25f }, ReleaseScale = new VariableFloat { Value = 48f, Variation = 32f }, BlendMode = EmitterBlendMode.Add, Term = 0.9f, MinimumTriggerPeriod = 0f }; this.mEmitter.ParticleTexture = mContent.Load<Texture2D>(@"Textures\LensFlare"); this.mEmitter.Modifiers.Add(new ColourModifier { InitialColour = Color.White.ToVector3(), UltimateColour = Color.Aqua.ToVector3() }); this.mEmitter.Modifiers.Add(new RotationRateModifier { InitialRate = 10f, FinalRate = 1f }); this.mEmitter.Modifiers.Add(new OpacityInterpolatorModifier { InitialOpacity = 0f, MiddleOpacity = 0.15f, MiddlePosition = 0.7f, FinalOpacity = 0f }); this.mParticleEffect = new ParticleEffect { this.mEmitter }; this.mParticleEffect.Initialise(); this.mParticleManager.Add(this.mParticleEffect); this.mParticleRenderer.LoadContent(this.mContent); this.mParticleEffect.LoadContent(this.mContent); this.mParticleEnabled = true; this.mWorld.ContactManager.BeginContact += BeginContact; this.mWorld.ContactManager.EndContact += EndContact; this.mInfo = new SensorInfoText(this.mContent, this.mGraphics, ConvertUnits.ToDisplayUnits(this.mPosition), Color.White); }
void Start() { horizontal = 0; canMove = true; canJump = true; MapStateFunctions(); player = GetComponent<Rigidbody2D>(); defaultMaxSpeed = speed; ChangeState(MovementState.GROUND); PEM = GameObject.FindGameObjectWithTag("Particles Manager").GetComponent<ParticleEffectManager>(); }
void Start() { hookBody = GetComponent <Rigidbody2D>(); hookBody.AddForce(transform.rotation * Vector2.right * hookSpeed, ForceMode2D.Impulse); partManag = GameObject.FindGameObjectWithTag("Particles Manager").GetComponent <ParticleEffectManager>(); }