当前位置: 首页>>代码示例>>C#>>正文


C# ParticleSystem.AddEmitter方法代码示例

本文整理汇总了C#中ParticleSystem.AddEmitter方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleSystem.AddEmitter方法的具体用法?C# ParticleSystem.AddEmitter怎么用?C# ParticleSystem.AddEmitter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleSystem的用法示例。


在下文中一共展示了ParticleSystem.AddEmitter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateScene

        // Just override the mandatory create scene method
        public override void CreateScene()
        {
            // Set ambient light
            sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f);

            // Create a skybox
            sceneMgr.SetSkyBox(true, "Examples/SpaceSkyBox", 50 );

            // Create a light
            Light l = sceneMgr.CreateLight("MainLight");
            // Accept default settings: point light, white diffuse, just set position
            // NB I could attach the light to a SceneNode if I wanted it to move automatically with
            //  other objects, but I don't
            l.Position = new Vector3(20,80,50);

            // Also add a nice starship in
            Entity ent = sceneMgr.CreateEntity( "razor", "razor.mesh" );

            sceneMgr.RootSceneNode.AttachObject( ent );

            pThrusters = sceneMgr.CreateParticleSystem( "ParticleSys1", 200 );

            pThrusters.MaterialName = "Examples/Flare";
            pThrusters.SetDefaultDimensions( 25, 25 );

            ParticleEmitter pEmit1 = pThrusters.AddEmitter( "Point" );
            ParticleEmitter pEmit2 = pThrusters.AddEmitter( "Point" );

            // Thruster 1
            pEmit1.Angle = new Degree(3);
            pEmit1.TimeToLive = 0.2f;
            pEmit1.EmissionRate = 70;

            pEmit1.ParticleVelocity = 50;

            pEmit1.Direction = -Vector3.UNIT_Z;
            pEmit1.SetColour(ColourValue.White, ColourValue.Red);

            // Thruster 2
            pEmit2.Angle = new Degree(3);
            pEmit2.TimeToLive = 0.2f;
            pEmit2.EmissionRate = 70;

            pEmit2.ParticleVelocity = 50;

            pEmit2.Direction = -Vector3.UNIT_Z;
            pEmit2.SetColour(ColourValue.White, ColourValue.Red);

            // Set the position of the thrusters
            pEmit1.Position = new Vector3( 5.7f, 0.0f, 0.0f );
            pEmit2.Position = new Vector3( -18.0f, 0.0f, 0.0f );

            sceneMgr.RootSceneNode.CreateChildSceneNode( new Vector3( 0.0f, 6.5f, -67.0f ) )
                .AttachObject(pThrusters);
        }
开发者ID:andyhebear,项目名称:mogresdk,代码行数:56,代码来源:SkyBoxApplication.cs

示例2: CreateScene

        protected override void CreateScene()
        {
            // since whole screen is being redrawn every frame, dont bother clearing
            // option works for GL right now, uncomment to test it out.  huge fps increase
            // also, depth_write in the skybox material must be set to on
            //mainViewport.ClearEveryFrame = false;

            // set ambient light
            scene.AmbientLight = new ColorEx(1.0f, 0.5f, 0.5f, 0.5f);

            // create a skybox
            scene.SetSkyBox(true, "Skybox/Space", 50);

            // create a light
            Light light = scene.CreateLight("MainLight");
            light.Position = new Vector3(20, 80, 50);

            // add a nice starship
            Entity ship = scene.CreateEntity("razor", "razor.mesh");
            scene.RootSceneNode.AttachObject(ship);

            thrusters = ParticleSystemManager.Instance.CreateSystem("ParticleSystem", 200);
            thrusters.MaterialName = "Particles/Flare";
            thrusters.DefaultWidth = 25;
            thrusters.DefaultHeight = 25;

            ParticleEmitter emitter1 = thrusters.AddEmitter("Point");
            ParticleEmitter emitter2 = thrusters.AddEmitter("Point");

            // thruster 1
            emitter1.Angle = 3;
            emitter1.TimeToLive = 0.2f;
            emitter1.EmissionRate = 70;
            emitter1.ParticleVelocity = 50;
            emitter1.Direction = -Vector3.UnitZ;
            emitter1.ColorRangeStart = ColorEx.White;
            emitter1.ColorRangeEnd = ColorEx.Red;

            // thruster 2
            emitter2.Angle = 3;
            emitter2.TimeToLive = 0.2f;
            emitter2.EmissionRate = 70;
            emitter2.ParticleVelocity = 50;
            emitter2.Direction = -Vector3.UnitZ;
            emitter2.ColorRangeStart = ColorEx.White;
            emitter2.ColorRangeEnd = ColorEx.Red;

            // set the position of the thrusters
            emitter1.Position = new Vector3(5.7f, 0, 0);
            emitter2.Position = new Vector3(-18, 0, 0);

            scene.RootSceneNode.CreateChildSceneNode(new Vector3(0, 6.5f, -67), Quaternion.Identity).AttachObject(thrusters);
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:53,代码来源:SkyBox.cs

示例3: ParticleEmitterCluster

        public ParticleEmitterCluster(ParticleSystem particleSystem, ParticleEmitter[] referenceEmitters, Vector3 position, uint particleQuotaPerEmitter, bool eternal)
        {
            this.ParticleSystem = particleSystem;
            this.ParticleQuotaPerEmitter = particleQuotaPerEmitter;
            this.Eternal = eternal;

            Emitters = new ParticleEmitter[referenceEmitters.Length];
            for (int i = 0; i < referenceEmitters.Length; ++i)
            {
                Emitters[i] = ParticleSystem.AddEmitter(referenceEmitters[i].Type);
                referenceEmitters[i].CopyParametersTo(Emitters[i]);
                TimeToLive = Math.Max(TimeToLive, Emitters[i].MaxTimeToLive + Emitters[i].MaxDuration);
            }
            this.Position = position;

            ParticleSystem.ParticleQuota += ParticleQuotaPerEmitter;
        }
开发者ID:nigelchanyk,项目名称:Archetype,代码行数:17,代码来源:ParticleEmitterCluster.cs

示例4: ParseEmitter

        /// <summary>
        /// 
        /// </summary>
        /// <param name="line"></param>
        /// <param name="system"></param>
        private void ParseEmitter(string type, TextReader script, ParticleSystem system)
        {
            ParticleEmitter emitter = system.AddEmitter(type);

            string line = "";

            while(line != null) {
                line = ParseHelper.ReadLine(script);

                if(!(line.Length == 0 || line.StartsWith("//"))) {
                    if(line == "}") {
                        // finished with this emitter
                        break;
                    }
                    else {
                        ParseEmitterAttrib(line.ToLower(), emitter);
                    }
                } // if
            } // while
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:25,代码来源:ParticleSystemManager.cs

示例5: Emitter

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="system">ParticleSystem that this Emitter will add itself to.</param>
        /// <param name="budget">Number of Particles available to this Emitter.</param>
        public Emitter(ParticleSystem system, int budget)
        {
            _budget = budget;

            _active = new LinkedList<Particle>();
            _idle = new Queue<Particle>(_budget);
            _modifiers = new List<Modifier>();
            _controllers = new List<Controller>();
            _snapCache = new Queue<Snapshot>(1024);
            _snapshots = new Queue<Snapshot>(1024);
            _sleeping = true;

            _dischargeQuantity = 1;
            _lifespan = 1000;
            _color = Color.White;
            _opacity = 1f;
            _scale = 1f;
            _speed = 0f;
            _speedRange = 0f;
            _strip = system.DefaultImageStrip;
            _frame = 1;
            _blend = SpriteBlendMode.Additive;

            Position = Vector2.Zero;

            //Fill the idle Particles queue with Particles...
            for (int i = 0; i < _budget; i++)
            {
                _idle.Enqueue(new Particle());
            }

            //Fill the Snapshot cache with empty Snapshots...
            for (int i = 0; i < 1024; i++)
            {
                _snapCache.Enqueue(GenerateSnapshot());
            }

            system.AddEmitter(this);
        }
开发者ID:Andrea,项目名称:MercuryParticleEngine,代码行数:44,代码来源:Emitter.cs

示例6: ParticleEmitter

 public ParticleEmitter(ParticleSystem system)
 {
     this.system = system;
     system.AddEmitter(this);
 }
开发者ID:nagysa1313,项目名称:Cannonball,代码行数:5,代码来源:ParticleEmitter.cs

示例7: LoadContent

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            ScreenSize = new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            screenWidth = GraphicsDevice.Viewport.Width;
            screenHeight = GraphicsDevice.Viewport.Height;

            BulletDir = Vector2.Zero;
            noOfClues = 5;

            // List of cases
            #region caseList
            Sprite CaseItem = new Sprite(Content.Load<Texture2D>("case"), new Rectangle(0, 0, Content.Load<Texture2D>("case").Width, Content.Load<Texture2D>("case").Height), 0.0f, SpriteEffects.None, Color.White);
            for (int i = 0; i < noOfClues; i++)
            {
                caseList.Add("Case" + i.ToString(), new CaseFile(Content.Load<Texture2D>("popUp"), new Rectangle(10, 10, 150, 200), new Rectangle(0, 0, 3200, 2400), 0.0f, SpriteEffects.None, Color.White, CaseItem.Copy(), "lol", "hehe", Vector2.Zero));
            }
            #endregion

            #region MenuSetup
            mainMenu = new Menu(new Rectangle(0, -5, screenWidth*8/10, screenHeight / 8), Content.Load<Texture2D>("MainMenuTitle"));
            mainMenu.Add(new Rectangle(0, 0, screenWidth / 10, screenHeight / 10), Content.Load<Texture2D>("MainMenuPlay"));
            mainMenu.Add(new Rectangle(0, 0, screenWidth / 5, screenHeight / 9), Content.Load<Texture2D>("MainMenuSettings"));
            mainMenu.Add(new Rectangle(0, 0, screenWidth / 12, screenHeight / 9), Content.Load<Texture2D>("MainMenuExit"));

            Alignment align = Alignment.Left;
            mainMenu.Setup(align, screenHeight, screenWidth);

            mainMenu.backgroundRectangle = new Rectangle(0, 0, screenWidth, screenHeight);
            mainMenu.backgroundTexture = Content.Load<Texture2D>("MainMenuBackground");
            #endregion

            // Creates the user
            player = new Player(
                Content.Load<Texture2D>("Tron_Charcter2"), 8, 3);

            player.Load();

            // Creates the enemy
            enemy = new Enemy(
                Content.Load<Texture2D>("Tron_Charcter2"), 8, 3);

            enemy.Load();
            CaseFont = Content.Load<SpriteFont>("cFont");

            splashScreen = new Sprite(Content.Load<Texture2D>("betaJester1"), new Rectangle(0, 0, screenWidth, screenHeight), 0.0f, SpriteEffects.None, Color.White);
            //ixjingle = Content.Load<SoundEffect>("ixjingle");
            //heartBeatIntro = Content.Load<SoundEffect>("GGJ13_Theme");
            background = new Background(Content.Load<Texture2D>("gamebackground"), Content.Load<Texture2D>("gamebackgroundback"), Content.Load<Texture2D>("gamebackgroundmiddle"), Content.Load<Texture2D>("gamebackgroundfront"), 200 * 32, screenWidth, screenHeight);
            playerData = PlayerData.Load();

            //heartBeatTracker = new HeartBeatTracker(Content.Load<SoundEffect>("heartBeat"));
            ParticleEffects = new ParticleSystem(Vector2.Zero);
            ParticleEffects.AddEmitter(new Vector2(0.001f, 0.6f),
                                            new Vector2(0, 1), new Vector2(0.0f * MathHelper.Pi, 0.0f * -MathHelper.Pi),
                                            new Vector2(1f, 1f),
                                            new Vector2(60, 70), new Vector2(15, 15f),
                                            Color.White, Color.White, Color.White, Color.White,
                                            new Vector2(0, 700), new Vector2(0, 120), 500, new Vector2(100, 100), Content.Load<Texture2D>("raindrop"), 0, (int)ScreenSize.X);
            if (playerData == null)
            {
                playerData = new PlayerData(100, 0.0f, 0, 0);
            }
            enemyGun = new Gun(new Vector2(enemy.enemyRectangle.X + enemy.enemyRectangle.Width, enemy.enemyRectangle.Y), Content.Load<Texture2D>("bullet"), new Rectangle(0, 0, Content.Load<Texture2D>("bullet").Width, Content.Load<Texture2D>("bullet").Height), 5, 0.0f, SpriteEffects.None, Color.White, 1, null, null, false);
            playerGun = new Gun(new Vector2(player.playerRectangle.X + player.playerRectangle.Width, player.playerRectangle.Y), Content.Load<Texture2D>("bullet"), new Rectangle(0, 0, Content.Load<Texture2D>("bullet").Width, Content.Load<Texture2D>("bullet").Height), 5, 0.0f, SpriteEffects.None, Color.White, 1, null, null, false);

            spriteBatch = new SpriteBatch(GraphicsDevice);
            Tile.TileSetTexture = Content.Load<Texture2D>("TileSet");
            background = new Background(Content.Load<Texture2D>("gameBackground"), Content.Load<Texture2D>("gameBackgroundBack"),
                Content.Load<Texture2D>("gameBackgroundMiddle"), Content.Load<Texture2D>("gameBackgroundFront"),
                (200 * 32), GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
        }
开发者ID:ggjbj,项目名称:CardiacArrest1,代码行数:78,代码来源:Game1.cs


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