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


C# Audio.SoundEffectInstance类代码示例

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


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

示例1: Play

 public static void Play(SoundEffectInstance sound, float volume, float pan, float pitch)
 {
     sound.Play();
     sound.Volume = volume;
     sound.Pan = pan;
     sound.Pitch = pitch;
 }
开发者ID:billyboy429,项目名称:tctk,代码行数:7,代码来源:AudioManager.cs

示例2: RemoveSoundInstance

 public static void RemoveSoundInstance(SoundEffectInstance instance)
 {
     lock (Sync)
     {
         States.Remove(instance);
     }
 }
开发者ID:TravisEvashkevich,项目名称:bell,代码行数:7,代码来源:AudioManager.cs

示例3: AddSoundInstance

 public static void AddSoundInstance(SoundEffectInstance instance)
 {
     lock (Sync)
     {
         States.Add(instance, instance.State);
     }
 }
开发者ID:TravisEvashkevich,项目名称:bell,代码行数:7,代码来源:AudioManager.cs

示例4: PlayEffect

 public void PlayEffect(SoundEffectInstance effect, float duration)
 {
     SoundEffectDescriptor sd = new SoundEffectDescriptor();
     sd.Effect = effect;
     sd.RemainingDuration = duration;
     _effects.Add(sd);
 }
开发者ID:STPKITT,项目名称:OpenNFS1,代码行数:7,代码来源:SoundEngine2.cs

示例5: AddInstance

 public static int AddInstance(SoundEffectInstance instance)
 {
     _idCounter++;
     _soundEffects.Add(_idCounter, instance);
     _soundInstancesLoaded++;
     return _idCounter;
 }
开发者ID:trew,项目名称:PoorJetX,代码行数:7,代码来源:SoundFxManager.cs

示例6: Motor

        public Motor(string name,ContentManager contentManager, string spriteName, int x, int y, Vector2 velocity,
            SoundEffect Sound, float soundVolume, float accSpeed, int mode)
            : base(contentManager, spriteName, x, y, velocity, Sound)
        {
            this.angle = 0;
              this.angleVelocity = 0;
              if(mode == 0)
              {
                  this.initialAccSpeed = accSpeed;
                  this.friction = 0.04F;
              }
              if(mode==1)
              {
                  this.initialAccSpeed = accSpeed;
                  this.friction = 0.065F;
              }

              this.accSpeed = this.initialAccSpeed;

              this.motorName = name;
              this.soundVolume = soundVolume;
              this.mode = mode;

              if (Sound != null)
              {
                  soundMotorInstance = this.Sound.CreateInstance();
                  soundMotorInstance.IsLooped = true;
                  soundMotorInstance.Volume = soundVolume - 0.2F;
                  this.soundMotorInstance.Play();
                  this.soundIsPlaying = true;
              }
        }
开发者ID:KrzyKuStudio,项目名称:Zuzuel,代码行数:32,代码来源:Motor.cs

示例7: Player

        public Player(string name, List<AnimatedTextureData> animationsList,
                    SpritePresentationInfo spritePresentationInfo,
                    SpritePositionInfo spritePositionInfo,
                    int frameRate)
            : base(name, animationsList,
                    spritePresentationInfo,
                    spritePositionInfo,
                    frameRate)
        {
            this.moveAmount = 0;
            this.velocity = Vector2.Zero;
            this.acceleration = 0.0015f;
            this.direction = Vector2.Zero;
            this.gravity = 0.0025f;
            this.jumpPower = 1.6f;
            this.springJumpPower = 2f;
            this.oldPos = new Vector2(spritePositionInfo.TRANSLATIONX, spritePositionInfo.TRANSLATIONY);
            this.hasKey = false;
            this.coins = 0;
            this.health = 3; // 3 health? 3 hearts?
            this.invulnerable = false;
            this.invulnerableTimer = 0;

            this.levelStartPos = spritePositionInfo.TRANSLATION;

            this.coinsTaken = new List<Block>();
            this.keysTaken = new List<Block>();

            this.jump = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("jump");
            this.pickup = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("pickup");
            this.hurt = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("hurt");
            this.endGame = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("endGame");
        }
开发者ID:Resinderate,项目名称:SensitiveWillum,代码行数:33,代码来源:Player.cs

示例8: SoundObject

 //Modular Constructor
 public SoundObject(SoundEffect target, Vector2 posn)
 {
     this.sound = target;
     this.position = posn;
     this.isModular = true;
     this.dynamic = sound.CreateInstance();
 }
开发者ID:pquinn,项目名称:time-sink,代码行数:8,代码来源:SoundObject.cs

示例9: Update

        /// <summary>
        /// Updates the position of the dog, and plays sounds.
        /// </summary>
        public override void Update(GameTime gameTime, AudioManager audioManager)
        {
            // Set the entity to a fixed position.
            Position = new Vector3(0, 0, -4000);
            Forward = Vector3.Forward;
            Up = Vector3.Up;
            Velocity = Vector3.Zero;

            // If the time delay has run out, start or stop the looping sound.
            // This would normally go on forever, but we stop it after a six
            // second delay, then start it up again after four more seconds.
            timeDelay -= gameTime.ElapsedGameTime;

            if (timeDelay < TimeSpan.Zero)
            {
                if (activeSound == null)
                {
                    // If no sound is currently playing, trigger one.
                    activeSound = audioManager.Play3DSound("DogSound", true, this);

                    timeDelay += TimeSpan.FromSeconds(6);
                }
                else
                {
                    // Otherwise stop the current sound.
                    activeSound.Stop(false);
                    activeSound = null;

                    timeDelay += TimeSpan.FromSeconds(4);
                }
            }
        }
开发者ID:Gevil,项目名称:Projects,代码行数:35,代码来源:Dog.cs

示例10: Initialize

        public static void Initialize(ContentManager content)
        {
            try
            {

                Start_Bgm = content.Load<SoundEffect>(@"Sounds\\Start");
                Start_Bgm_Instance = Start_Bgm.CreateInstance();
                Start_Bgm_Instance.IsLooped = true;

                Stage1_3_Bgm = content.Load<SoundEffect>(@"Sounds\\Stage1_3");
                Stage1_3_Bgm_Instance = Stage1_3_Bgm.CreateInstance();
                Stage1_3_Bgm_Instance.IsLooped = true;

                Stage4_6_Bgm = content.Load<SoundEffect>(@"Sounds\\Stage4_6");
                Stage4_6_Bgm_Instance = Stage4_6_Bgm.CreateInstance();
                Stage4_6_Bgm_Instance.IsLooped = true;

                playerShot = content.Load<SoundEffect>(@"Sounds\\Shot1");
                enemyShot = content.Load<SoundEffect>(@"Sounds\\Shot2");

                enemy3Shot = content.Load<SoundEffect>(@"Sounds\\Explosion1");
                Enemy6_pattern1 = content.Load<SoundEffect>(@"Sounds\\Enemy6_pattern1");
                Enemy6_pattern1_2 = content.Load<SoundEffect>(@"Sounds\\Enemy6_pattern1_2");
                for (int x = 1; x <= explosionCount; x++)
                {
                    explosions.Add(content.Load<SoundEffect>(@"sounds\Explosion" + x.ToString()));
                }
            }
            catch
            {
                Debug.Write("SoundManager Initialization Failed");
            }
        }
开发者ID:jeongdujin,项目名称:TimeRunRPG,代码行数:33,代码来源:SoundManager.cs

示例11: Initialize

        public static void Initialize(ContentManager content)
        {
            scream = content.Load<SoundEffect>("Assets/Sounds/deathScream");
            collectSound = content.Load<SoundEffect>("Assets/Sounds/itemCollect");
            checkpointHell = content.Load<SoundEffect>("Assets/Sounds/CheckpointHell");
            checkpointCrystal = content.Load<SoundEffect>("Assets/Sounds/CheckpointCristall");
            fireball = content.Load<SoundEffect>("Assets/Sounds/Fireball");
            freezingIce = content.Load<SoundEffect>("Assets/Sounds/freezingIce");
            whip = content.Load<SoundEffect>("Assets/Sounds/whip");
            laser = content.Load<SoundEffect>("Assets/Sounds/laser");
            SeraphinScream = content.Load<SoundEffect>("Assets/Sounds/SeraphinScream");
            thunder = content.Load<SoundEffect>("Assets/Sounds/thunder");
            spear = content.Load<SoundEffect>("Assets/Sounds/spear");
            claws = content.Load<SoundEffect>("Assets/Sounds/claws");
            mainMenu = content.Load<SoundEffect>("Assets/Sounds/mainMenu");
            menu = mainMenu.CreateInstance();
            menu.IsLooped = true;
            punch = content.Load<SoundEffect>("Assets/Sounds/punch");
            waterSound = content.Load<SoundEffect>("Assets/Sounds/water");
            water = waterSound.CreateInstance();
            spawn = content.Load<SoundEffect>("Assets/Sounds/spawn");
            minionsFraktus = content.Load<SoundEffect>("Assets/Sounds/minions");
            goldCave = content.Load<SoundEffect>("Assets/Sounds/GoldCave");
            cave = goldCave.CreateInstance();
            //cave.IsLooped = true;

            //background crystal
            crystalBackground = content.Load<SoundEffect>("Assets/Sounds/crystalBackground");
            crystalBG = crystalBackground.CreateInstance();
            crystalBG.Volume = 0.25f;
            crystalBG.IsLooped = true;
        }
开发者ID:KleinerMensch,项目名称:CR4VE,代码行数:32,代码来源:Sounds.cs

示例12: MenuScreen

        public MenuScreen()
        {
            isActive = false;
            isHidden = true;
            canLauchChallenge = false;

            menuSound = SoundEffectLibrary.Get("cursor").CreateInstance();

            m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("menu_start_bg"), m_transform);
            m_sprite.Transform.Position = outPos;
            arrow = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("arrow"), new Transform(m_transform, true));

            moveTo = new MoveToStaticAction(Program.TheGame, m_transform, inPos, 1);
            moveTo.StartPosition = new Vector2(80, 200);
            moveTo.Interpolator = new PSmoothstepInterpolation();
            moveTo.Timer.Interval = 0.5f;

            moveOut = new MoveToStaticAction(Program.TheGame, m_transform, outPos, 1);
            moveOut.StartPosition = inPos;
            moveOut.Interpolator = new PSmoothstepInterpolation();
            moveOut.Timer.Interval = 0.5f;

            choice = MenuState.START;
            challengeChoice = ChallengeState.CHALL_1;
        }
开发者ID:TastyWithPasta,项目名称:GameboyJam2013,代码行数:25,代码来源:MenuScreen.cs

示例13: LoadContent

        public void LoadContent(SpriteBatch spriteBatch, ContentManager Content, Viewport viewport, 
            Camera camera, Texture2D enemyTexture, GraphicsDeviceManager graphics, 
            SoundEffect _backgroundMusic, GameController _gameController, 
            SoundEffect _fireballSound, SpriteFont _spritefont, Texture2D _bossTexture)
        {
            _enemyTexture = enemyTexture;
            this.camera = camera;
            _graphics = graphics;

            spritefont = _spritefont;

            bossTexture = _bossTexture;

            backgroundMusic = _backgroundMusic;
            fireballSound = _fireballSound;

            _content = Content;
            gameController = _gameController;
            character = Content.Load<Texture2D>("imp");
            Flame.SetTexture(Content.Load<Texture2D>("Flames"));
            
            soundEffectInstance = backgroundMusic.CreateInstance();

            onFirstLevel = false;
            onSecondLevel = false;
            onThirdLevel = false;
            onFourthLevel = false;

        }
开发者ID:KevinUd2014,项目名称:Release2KillerStory,代码行数:29,代码来源:GameController.cs

示例14: Initialize

        public override void Initialize(ContentManager content, Vector2 position, Loot theLoot, Wave theWave)
        {
            parachuteRip = (content.Load<SoundEffect>("Music\\Rip.wav")).CreateInstance();
            FlyingTexture = content.Load<Texture2D>("Graphics\\ParachuteEnemy");
            /*
            EnemyDeathTexture = content.Load<Texture2D>("Graphics\\Enemy1Dead");
            FiringTexture = content.Load<Texture2D>("Graphics\\Enemy1Firing");

            EnemyTextureMap = new AnimatedSprite(content.Load<Texture2D>("Graphics\\Enemy1Map"), numMapRows, numMapColumns, animationSpeed);
            speed = E1Speed;
            base.Initialize(content, position, theLoot, theWave);
             * */

            base.Initialize(content, position, theLoot, theWave);

            if (inSky)
            {
                if (position.X < 0)
                {
                    speed *= 2;
                    Position = new Vector2(100, -75);
                }
                else
                {
                    speed *= 2;
                    Position = new Vector2(650, -75);
                }
            }
        }
开发者ID:pel5xq,项目名称:InFoxholesGame,代码行数:29,代码来源:ParachuteEnemy.cs

示例15: Player

        /// <summary>
        /// The parameterized constructor for the player class
        /// </summary>
        /// <param name="pTexture">The texture that the player will use</param>
        /// <param name="g">The GraphicsDeviceManager that will be used</param>
        public Player(Texture2D pTexture, GraphicsDeviceManager gdm, World w, Texture2D fTexture)
        {
            //Load the texture and set the vectors
            graphic = gdm;
            screenWidth = gdm.PreferredBackBufferWidth;
            screenHeight = gdm.PreferredBackBufferHeight;
            position = new Vector2(150, 50);
            body = new Rectangle((int)position.X, (int)position.Y, 50, 50);
            //TODO: add content manager

            burning = w.game.Content.Load<SoundEffect>("Audio/WAVs/fire");
            burning2 = burning.CreateInstance();

            texture = pTexture;
            flameTexture = fTexture;
            velocity = new Vector2(0, 0);
            world = w;
            world.Player = this;
            //Set the player state
            hState = HorizontalState.standing;

            //Make an array of three torches
            torches = new Torch[999];
            for (int i = 0; i < torches.Length; i++)
            {
                torches[i] = new Torch(this, fTexture, w);
            }
        }
开发者ID:jewinemiller,项目名称:Leap,代码行数:33,代码来源:Player.cs


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