• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ParticleEffect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ParticleEffect的典型用法代码示例。如果您正苦于以下问题:C# ParticleEffect类的具体用法?C# ParticleEffect怎么用?C# ParticleEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ParticleEffect类属于命名空间,在下文中一共展示了ParticleEffect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnValueChanged

 public static void OnValueChanged(object sender, OnValueChangeEventArgs args)
 {
     var oldOne = args.GetOldValue<KeyBind>().Active;
     var newOne = args.GetNewValue<KeyBind>().Active;
     if (oldOne == newOne) return;
     if (newOne)
     {
         _effect?.Dispose();
         _effect = Members.MyHero.AddParticleEffect("materials/ensage_ui/particles/line.vpcf");
         var frontPoint = Members.MyHero.InFront(1200);
         _effect.SetControlPoint(1, Members.MyHero.Position);
         _effect.SetControlPoint(2, frontPoint);
         _effect.SetControlPoint(3, new Vector3(255, 50, 0));
         _effect.SetControlPoint(4, new Vector3(255, 255, 255));
     }
     else
         try
         {
             _tks.Cancel();
             _effect?.Dispose();
         }
         catch (Exception)
         {
             // ignored
         }
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:26,代码来源:ReamBlink.cs


示例2: Serialize

        /// <summary>
        /// Serializes the specified ParticleEffect instance.
        /// </summary>
        /// <param name="effect">The ParticleEffect to be serialized.</param>
        /// <param name="filename">The desired output file name,</param>
        public void Serialize(ParticleEffect effect, string filename)
        {
            // Create a new xml document...
            XDocument xmlDocument = new XDocument();

            // Use the XNA serializer to populate the xml document...
            using (XmlWriter writer = xmlDocument.CreateWriter())
            {
                IntermediateSerializer.Serialize<ParticleEffect>(writer, effect, ".\\");
            }

            //// hack: Workaround for intermediate serializer not putting nodes in the right order...
            //foreach (XElement emitterElement in xmlDocument.Descendants("Asset").Elements("Item"))
            //{
            //    XElement releaseQuantityElement = emitterElement.Element("ReleaseQuantity");

            //    if ((releaseQuantityElement.PreviousNode as XElement).Name == "Name")
            //    {
            //        XElement termElement = emitterElement.Element("Term");

            //        termElement.AddAfterSelf(releaseQuantityElement);

            //        releaseQuantityElement.Remove();
            //    }
            //}

            // Save the xml document...
            xmlDocument.Save(filename);
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:34,代码来源:DefaultEffectSerializationPlugin.cs


示例3: Init

        void Init()
        {
            Effect = new ParticleEffect();

            Effect.OnEnding += new ParticleEffect.ParticleEffectEventHandler(Effect_OnEnding);

            Effect.Texture = Create.Texture("blurredbar");

            Effect.Position = Position;

            Effect.ParticleCount = 150;
            Effect.GenerationPeriod = .1D;
            Effect.GenerationCount = 20;

            Effect.Gravity = 0F;
            Effect.Mass = new Vector2f(10, 10);
            Effect.MinPosition = new Vector2f(-15F, -4F);
            Effect.MaxPosition = new Vector2f(15F, 4F);
            Effect.MinColor = Color.Green;
            Effect.MaxColor = Color.Green;
            Effect.Acceleration = new Vector2f(0f, 5f);
            Effect.AlphaLimit = new Vector2f(0.55f, .8f);
            Effect.Angle = new Vector2f(270f, 270f);
            Effect.DurationTime = new Vector2f(.5f, 1.2f);
            Effect.Rotation = new Vector2f(0, 0);
            Effect.MinScale = new Vector2f(.003f, .003f);
            Effect.MaxScale = new Vector2f(.02f, .02f);
            const float SV = .1F;
            Effect.MinScaleVariation = new Vector2f(SV, SV);
            Effect.MaxScaleVariation = new Vector2f(SV, SV);
            Effect.Velocity = new Vector2f(10F, 70F);

            Effect.Init();
        }
开发者ID:jpx,项目名称:blazera,代码行数:34,代码来源:ParticleMapEffect.cs


示例4: ParticleMapEffect

        public ParticleMapEffect(ParticleMapEffect copy)
            : base(copy)
        {
            DrawOrder = DrawOrder.Normal;

            Effect = new ParticleEffect(copy.Effect);
        }
开发者ID:jpx,项目名称:blazera,代码行数:7,代码来源:ParticleMapEffect.cs


示例5: Gfx

        private Gfx()
        {
            var images = new ImageCollection();
            // walls
            images.AddImage("walls", "Resources/gfx/blocks/green-wall.png");
            images.AddImage("trees", "Resources/gfx/blocks/tree-wall.png");

            // players
            images.AddImage("player-movement", "Resources/gfx/tanks/tank.png");
            images.AddImage("enemy-movement", "Resources/gfx/tanks/enemy.png");
            images.AddImage("player-bullet-flight", "Resources/gfx/bullets/bullet.png");

            // menu
            images.AddImage("game-menu-background", "Resources/gfx/menu/title.png");
            images.AddImage("game-ground", "Resources/gfx/menu/title.png");

            // bonus
            images.AddImage("bonus-boom", "Resources/gfx/bonus/boom.png");
            images.AddImage("bonus-health", "Resources/gfx/bonus/health.png");
            images.AddImage("bonus-life", "Resources/gfx/bonus/life.png");

            m_worldTexture = new Texture(images, PixelFormat.DefaultAlpha);

            UnitExplosion = new ParticleEffect("Resources/gfx/particles/rocket-explosion-smoke.peff");
            RocketExplosionParticleEffect = new ParticleEffect("Resources/gfx/particles/rocket-explosion.peff");
        }
开发者ID:rinat,项目名称:battle,代码行数:26,代码来源:Gfx.cs


示例6: CreateRangeDisplay

 /// <summary>
 ///     The create range display.
 /// </summary>
 public void CreateRangeDisplay()
 {
     this.RangeDisplay = this.Entity.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
     this.RangeDisplay.SetControlPoint(1, new Vector3(255, 80, 80));
     this.RangeDisplay.SetControlPoint(3, new Vector3(9, 0, 0));
     this.RangeDisplay.SetControlPoint(2, new Vector3(this.Radius + 30, 255, 0));
 }
开发者ID:Ray0fHope,项目名称:EnsageSharp,代码行数:10,代码来源:LandMine.cs


示例7: ParticleSystem

        public ParticleSystem(ParticleSettings settings, Effect effect)
        {
            if (settings == null) throw new ArgumentNullException("settings");
            if (effect == null) throw new ArgumentNullException("effect");
            if (settings.Texture == null) throw new ArgumentException("Texture is null.");

            Enabled = true;

            this.settings = settings;

            //----------------------------------------------------------------
            // システム名

            Name = settings.Name;

            //----------------------------------------------------------------
            // エフェクト

            particleEffect = new ParticleEffect(effect);
            particleEffect.Initialize(settings, settings.Texture);

            graphicsDevice = particleEffect.GraphicsDevice;

            //----------------------------------------------------------------
            // パーティクル

            particles = new ParticleVertex[settings.MaxParticles * 4];

            for (int i = 0; i < settings.MaxParticles; i++)
            {
                particles[i * 4 + 0].Corner = new Short2(-1, -1);
                particles[i * 4 + 1].Corner = new Short2(1, -1);
                particles[i * 4 + 2].Corner = new Short2(1, 1);
                particles[i * 4 + 3].Corner = new Short2(-1, 1);
            }

            //----------------------------------------------------------------
            // 頂点バッファ

            vertexBuffer = new DynamicVertexBuffer(
                graphicsDevice, ParticleVertex.VertexDeclaration, settings.MaxParticles * 4, BufferUsage.WriteOnly);

            //----------------------------------------------------------------
            // インデックス バッファ

            var indices = new ushort[settings.MaxParticles * 6];
            for (int i = 0; i < settings.MaxParticles; i++)
            {
                indices[i * 6 + 0] = (ushort) (i * 4 + 0);
                indices[i * 6 + 1] = (ushort) (i * 4 + 1);
                indices[i * 6 + 2] = (ushort) (i * 4 + 2);

                indices[i * 6 + 3] = (ushort) (i * 4 + 0);
                indices[i * 6 + 4] = (ushort) (i * 4 + 2);
                indices[i * 6 + 5] = (ushort) (i * 4 + 3);
            }

            indexBuffer = new IndexBuffer(graphicsDevice, typeof(ushort), indices.Length, BufferUsage.WriteOnly);
            indexBuffer.SetData(indices);
        }
开发者ID:willcraftia,项目名称:TestBlocks,代码行数:60,代码来源:ParticleSystem.cs


示例8: Tombstone

        public Tombstone(Unit unit)
        {
            this.unit = unit;
            PositionCorrection = new Vector2(25);
            var level = (uint)char.GetNumericValue(unit.Name.Last());
            Radius =
                Ability.GetAbilityDataByName(AbilityName)
                    .AbilitySpecialData.First(x => x.Name == "radius")
                    .GetValue(level - 1);
            Duration =
                Ability.GetAbilityDataByName(AbilityName)
                    .AbilitySpecialData.First(x => x.Name == "duration")
                    .GetValue(level - 1);
            Position = unit.Position;
            Texture = Drawing.GetTexture("materials/ensage_ui/other/tombstone");
            Handle = unit.Handle;
            TextureSize = new Vector2(40);
            EndTime = Game.RawGameTime + Duration;
            ShowTimer = Menu.TimerEnabled(AbilityName);

            if (Menu.RangeEnabled(AbilityName))
            {
                ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
                ParticleEffect.SetControlPoint(1, new Vector3(128, 128, 128));
                ParticleEffect.SetControlPoint(2, new Vector3(Radius, 255, 0));
            }
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:27,代码来源:Tombstone.cs


示例9: Create

 /// <summary>
 ///     The create.
 /// </summary>
 public void Create()
 {
     this.rangeDisplay = this.me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
     this.rangeDisplay.SetControlPoint(1, new Vector3(255, 80, 50));
     this.rangeDisplay.SetControlPoint(3, new Vector3(20, 0, 0));
     this.lastRange = this.GetAttackRange();
     this.rangeDisplay.SetControlPoint(2, new Vector3(this.lastRange, 255, 0));
 }
开发者ID:Ray0fHope,项目名称:EnsageSharp,代码行数:11,代码来源:RangeDrawing.cs


示例10: RenderEffect

        /// <summary>
        /// Renders the specified ParticleEffect.
        /// </summary>
        public virtual void RenderEffect(ParticleEffect effect)
        {
            Guard.ArgumentNull("effect", effect);

            Matrix ident = Matrix.Identity;

            this.RenderEffect(effect, ref ident);
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:11,代码来源:Renderer.cs


示例11: DrawLine

 private static void DrawLine(Vector3 position, float size, int directionf, int directionu)
 {
     var effect = new ParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf", position);
     ParticleEffects.Add(effect);
     effect.SetControlPoint(1, new Vector3(0, 125, 0));
     effect.SetControlPoint(2, new Vector3(size, 255, 0));
     effect.SetControlPointOrientation(4, new Vector3(directionf, 0, 0), new Vector3(directionu, 0, 0), new Vector3(0, 0, 0));
 }
开发者ID:dendimonster,项目名称:Ensage,代码行数:8,代码来源:Program.cs


示例12: RenderEffect

        /// <summary>
        /// Renders the specified ParticleEffect.
        /// </summary>
        public void RenderEffect(ParticleEffect effect, SpriteBatch spriteBatch)
        {
            Guard.ArgumentNull("effect", effect);
            Guard.ArgumentNull("spriteBatch", spriteBatch);

            for (int i = 0; i < effect.Count; i++)
                this.RenderEmitter(effect[i], spriteBatch);
        }
开发者ID:danielselnick,项目名称:Sentry-Smash,代码行数:11,代码来源:SpriteBatchRenderer.cs


示例13: Tracker

 public Tracker(Entity v,ParticleEffect ef)
 {
     V = v;
     Ef = ef;
     /*Game.OnUpdate += args =>
     {
         Printer.Print($"{ef.Name}/{ef.IsDestroyed}/{ef.IsManaged}/{ef.IsValid}/{ef.RefCount}");
     };*/
 }
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:9,代码来源:Tracker.cs


示例14: Ward

 protected Ward(Vector3 position, string abilityName)
 {
     Position = position;
     RequiresUpdate = true;
     TextureSize = new Vector2(50, 35);
     if (Menu.RangeEnabled(abilityName))
     {
         ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
     }
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:10,代码来源:Ward.cs


示例15: Serialize

        /// <summary>
        /// Serializes the specified particle effect to the specified file path.
        /// </summary>
        /// <param name="particleEffect">The particle effect to be serialized.</param>
        /// <param name="filePath">The path to the desired output file.</param>
        public void Serialize(ParticleEffect particleEffect, string filePath)
        {
            XDocument xmlDocument = new XDocument();

            using (XmlWriter writer = xmlDocument.CreateWriter())
            {
                IntermediateSerializer.Serialize<ParticleEffect>(writer, particleEffect, ".\\");
            }

            xmlDocument.Save(filePath);
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:16,代码来源:DefaultSerializer.cs


示例16: DrawRange

        private void DrawRange()
        {
            if (ParticleEffect == null)
            {
                return;
            }

            ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
            ParticleEffect.SetControlPoint(1, new Vector3(255, 255, 0));
            ParticleEffect.SetControlPoint(2, new Vector3(Radius, 255, 0));
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:11,代码来源:ObserverWard.cs


示例17: RenderEffect

        /// <summary>
        /// Renders the specified particle effect.
        /// </summary>
        /// <param name="effect">The particle effect to render.</param>
        /// <param name="worldMatrix">The world transformation matrix.</param>
        /// <param name="viewMatrix">The view matrix.</param>
        /// <param name="projectionMatrix">The projection matrix.</param>
        /// <param name="cameraPosition">The camera matrix.</param>
        public void RenderEffect(ParticleEffect effect, ref Matrix worldMatrix,
                                                        ref Matrix viewMatrix,
                                                        ref Matrix projectionMatrix,
                                                        ref Vector3 cameraPosition)
        {
#if UNSAFE
            unsafe
#endif
            {
                this.PreRender(ref worldMatrix, ref viewMatrix, ref projectionMatrix);

                //Pre-multiply any proxies world matrices with the passed in world matrix
                if (effect.Proxies != null && worldMatrix != Matrix.Identity)
                {
                    effect.SetFinalWorld(ref worldMatrix);
                }

                for (Int32 i = 0; i < effect.Emitters.Count; i++)
                {
                    AbstractEmitter emitter = effect.Emitters[i];

                    // Skip if the emitter does not have a texture...
                    if (emitter.ParticleTexture == null)
                        continue;

                    // Skip if the emitter blend mode is set to 'None'...
                    if (emitter.BlendMode == EmitterBlendMode.None)
                        continue;

                    // Skip if the emitter has no active particles...
                    if (emitter.ActiveParticlesCount == 0)
                        continue;

                    BlendState blendState = BlendStateFactory.GetBlendState(emitter.BlendMode);



                    RenderContext context = new RenderContext(emitter.BillboardStyle, emitter.BillboardRotationalAxis, blendState, emitter.ParticleTexture, ref worldMatrix, ref viewMatrix, ref projectionMatrix, ref cameraPosition, emitter.ActiveParticlesCount, emitter.UseVelocityAsBillboardAxis);

                    Counters.ParticlesDrawn += emitter.ActiveParticlesCount;
#if UNSAFE
                    fixed (Particle* buffer = emitter.Particles)
#else
                    Particle[] buffer = emitter.Particles;
#endif
                    {
                        ParticleIterator iterator = new ParticleIterator(buffer, emitter.Budget, emitter.ActiveIndex, emitter.ActiveParticlesCount);

                        this.Render(ref context, ref iterator);
                    }
                }
            }
        }
开发者ID:kishoreVen,项目名称:mpe,代码行数:61,代码来源:AbstractRenderer.cs


示例18: RemoteMine

 public RemoteMine(Vector3 position)
     : base(position)
 {
     if (Menu.RangeEnabled(AbilityName))
     {
         ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", position);
     }
     RequiresUpdate = true;
     Duration =
         Ability.GetAbilityDataByName(AbilityName).AbilitySpecialData.First(x => x.Name == "duration").Value;
     Initialize();
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:12,代码来源:RemoteMine.cs


示例19: Mine

        protected Mine(Unit unit, string abilityName)
        {
            Unit = unit;
            Position = unit.Position;
            Texture = Drawing.GetTexture("materials/ensage_ui/other/" + unit.Name);
            Handle = unit.Handle;
            TextureSize = new Vector2(40);

            if (Menu.RangeEnabled(abilityName))
            {
                ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
            }
        }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:13,代码来源:Mine.cs


示例20: RenderEffect

        public void RenderEffect(GraphicsContext graphicsContext, ParticleEffect particleEffect)
        {
            for (int i = 0; i < particleEffect.Emitters.Count; i++)
            {
                ParticleEmitter emitter = particleEffect.Emitters[i];
                if (emitter.Buffer.Count == 0)
                {
                    continue;
                }

                ParticleBuffer.Iterator iterator = emitter.Buffer.CreateIterator(this.IteratorMode);
                TextureDefinition textureDefinition = (emitter.Texture != TextureDefinition.Empty) ? emitter.Texture : new TextureDefinition(graphicsContext.BlankTexture);
                this.Render(graphicsContext, ref iterator, textureDefinition, emitter.BlendMode);
            }
        }
开发者ID:JaakkoLipsanen,项目名称:Flai.XNA,代码行数:15,代码来源:ParticleRenderer.cs



注:本文中的ParticleEffect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ParticleEmitter类代码示例发布时间:2022-05-24
下一篇:
C# Particle类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap