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


C# Cue.Apply3D方法代码示例

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


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

示例1: Apply3DPosition

 public void Apply3DPosition(Cue cue, AudioListener listener, AudioEmitter emitter,
     Vector3 listenerPosition, Vector3 emitterPosition)
 {
     listenerPosition = listener.Position;
     emitterPosition = emitter.Position;
     cue.Apply3D(listener, emitter);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:7,代码来源:Audio.cs

示例2: Apply3DAll

 public void Apply3DAll(Cue cue, AudioListener listener, AudioEmitter emitter, Vector3 listenerPosition,
     Vector3 emitterPosition, Vector3 listenerVelocity, Vector3 emitterVelocity)
 {
     listenerPosition = listener.Position;
     emitterPosition = emitter.Position;
     listener.Velocity = listener.Velocity;
     emitter.Velocity = emitter.Velocity;
     cue.Apply3D(listener, emitter);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:9,代码来源:Audio.cs

示例3: PlayCue

        public void PlayCue(
			string name,
			AudioListener listener,
			AudioEmitter emitter
		)
        {
            if (String.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            if (!INTERNAL_cueData.ContainsKey(name))
            {
                throw new InvalidOperationException("name not found!");
            }
            Cue newCue = new Cue(
                INTERNAL_baseEngine,
                INTERNAL_waveBankNames,
                name,
                INTERNAL_cueData[name],
                true
            );
            newCue.Apply3D(listener, emitter);
            newCue.Play();
        }
开发者ID:AesteroidBlues,项目名称:FNA,代码行数:24,代码来源:SoundBank.cs

示例4: Apply3DVelocity

 public void Apply3DVelocity(Cue cue, AudioListener listener, AudioEmitter emitter, Vector3 emitterVelocity, Vector3 listenerVelocity)
 {
     listenerVelocity = listener.Velocity;
     emitterVelocity = emitter.Velocity;
     cue.Apply3D(listener, emitter);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:6,代码来源:Audio.cs

示例5: Apply3D

 public void Apply3D(Cue cue, AudioListener listener, AudioEmitter emitter)
 {
     cue.Apply3D(listener, emitter);
 }
开发者ID:bradleat,项目名称:trafps,代码行数:4,代码来源:Audio.cs

示例6: HandlePlayerInput

        /// <summary>
        /// Handles input for the specified player. In local game modes, this is called
        /// just once for the controlling player. In network modes, it can be called
        /// more than once if there are multiple profiles playing on the local machine.
        /// Returns true if we should continue to handle input for subsequent players,
        /// or false if this player has paused the game.
        /// </summary>
        bool HandlePlayerInput(InputState input, PlayerIndex playerIndex)
        {
            // Look up inputs for the specified player profile.
            KeyboardState keyboardState = input.CurrentKeyboardStates[(int)playerIndex];
            GamePadState gamePadState = input.CurrentGamePadStates[(int)playerIndex];

            // The game pauses either if the user presses the pause button, or if
            // they unplug the active gamepad. This requires us to keep track of
            // whether a gamepad was ever plugged in, because we don't want to pause
            // on PC if they are playing with a keyboard and have no gamepad at all!
            bool gamePadDisconnected = !gamePadState.IsConnected &&
                                       input.GamePadWasConnected[(int)playerIndex];

            if (input.IsPauseGame(playerIndex) || gamePadDisconnected)
            {
                if (sessionState == SessionState.Started)
                {
                    ScreenManager.AddScreen(new PauseMenuScreen(networkSession), playerIndex);

                    ScreenManager.menu_change.Play();

                    return false;
                }

                if (sessionState == SessionState.Complete)
                {
                    Exit();
                }
            }

            if (sessionState == SessionState.Started
                || sessionState == SessionState.Edit)
            {
                float timeDifference = (float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000.0f;

                Player.HandleInput(timeDifference);

                PlayerIndex pI = PlayerIndex.Four;
                if (input.IsNewKeyPress(Keys.Space, playerIndex, out pI)
                    ||
                    input.IsNewButtonPress(Buttons.RightTrigger, playerIndex, out pI))
                {
                    if (!parentGame.NormalMode)
                    {
                        if (TimeRemaining > 0)
                            FireBullet();
                    }
                    else
                        FireBullet();
                }

                float thumbRX = gamePadState.ThumbSticks.Right.X;
                if (thumbRX != 0)
                {
                    Player.turretRotationValue -= 0.05f * thumbRX;
                    float value = MathHelper.ToDegrees(Player.turretRotationValue);
                    value = (float)Math.Round(value, 0);
                    if (value % 10 == 0)
                    {
                        if (!RotateCue.IsPlaying)
                        {
                            RotateCue = parentGame.soundBank.GetCue("rotate");
                            AudioEmitter emmit = new AudioEmitter();
                            emmit.Position = Player.position;
                            RotateCue.Apply3D(listener, emmit);
                            RotateCue.Play();
                        }
                    }
                }

                float thumbRY = gamePadState.ThumbSticks.Right.Y;
                if (thumbRY != 0)
                {
                    Player.cannonRotationValue -= 0.05f * thumbRY;
                    Player.cannonRotationValue = MathHelper.Clamp(Player.cannonRotationValue, MathHelper.ToRadians(-45), MathHelper.ToRadians(10));

                    float value = MathHelper.ToDegrees(Player.cannonRotationValue);
                    value = (float)Math.Round(value, 0);
                    if (value % 2 == 0
                        && value != -45
                        && value != 10)
                    {
                        if (!ElevateCue.IsPlaying)
                        {
                            ElevateCue = parentGame.soundBank.GetCue("elevate");
                            AudioEmitter emmit = new AudioEmitter();
                            emmit.Position = Player.position;
                            ElevateCue.Apply3D(listener, emmit);
                            ElevateCue.Play();

                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:alittle1234,项目名称:XNA_Project,代码行数:101,代码来源:GameplayScreen.cs

示例7: FireBullet

        void FireBullet()
        {
            float timeNow = (float)gameTime.TotalGameTime.TotalMilliseconds / 1000.0f;
            float timeDiff = timeNow - shotTime;

            if ((MissileRemain > 0) && (timeDiff > ReloadTimeSec))
            {
                shotTime = timeNow;
                //MissileRemain--;

                Missile missile = new Missile(parentGame, rocketModel, rocketTextures, NormalDrawing, this);
                missile.position = new Vector3(
                    Player.position.X,
                    Player.position.Y,
                    Player.position.Z);
                Vector3 forwardVec = Matrix.CreateFromYawPitchRoll(
                    Player.turretRotationValue - MathHelper.ToRadians(90f),
                    0f,
                    0f).Forward;
                forwardVec.Normalize();

                missile.position += forwardVec * 11;

                missile.scale = 1;

                float DECLINATION = -Player.cannonRotationValue; // stays in radians

                // sin in radians                       // width                    // height
                missile.position.Y = (float)(Math.Sin(DECLINATION) * 13.3) + Player.position.Y + 4;

                float ROTATION = Player.turretRotationValue - MathHelper.ToRadians(90f);
                Matrix Orientation = Matrix.CreateFromYawPitchRoll(ROTATION, DECLINATION, 0f);
                //LevelVars.Player.FacingDirection
                //DECLINATION
                missile.SetBody(Orientation);

                Vector3 force = Orientation.Forward;
                force.Normalize();
                Vector3 angle = Orientation.Left;
                angle.Normalize();

                float power = 120f * Player.Power;
                missile.Body.ApplyWorldImpulse(force * power);
                missile.Body.AngularVelocity = (angle * MathHelper.Clamp((0.8f - Player.Power), 0.20f, 0.6f));

                missile.rgob.limbs[0].PhysicsBody.ApplyWorldImpulse(force * power * 5);
                missile.rgob.limbs[0].PhysicsBody.AngularVelocity = (angle * MathHelper.Clamp((0.8f - Player.Power), 0.20f, 0.6f) * 1);

                //missile.Body.AngularVelocity += (force * 1.5f);

                missile.Skin.callbackFn += new CollisionCallbackFn(MissileColllisionFunction);

                BulletList.Add(missile);

                FollowCam.Following = true;
                FollowCam.myMissile = missile;
                FollowCam.NewUpDownRot = missile.rotation.Y;
                FollowCam.NewLeftRightRot = (Player.turretRotationValue - MathHelper.ToRadians(90));

                cue = parentGame.soundBank.GetCue("fire");
                AudioEmitter emmit = new AudioEmitter();
                emmit.Position = Player.position;
                cue.Apply3D(listener, emmit);
                cue.Play();

                Vector3 effectPos = (missile.position - forwardVec * 2);
                for (int i = 0; i < 25; ++i)
                    NormalDrawing.shotSmokeParticles.AddParticle(effectPos, new Vector3(0, 0, 0));

                for (int i = 0; i < 25; ++i)
                    NormalDrawing.shotExplosionParticles.AddParticle(effectPos, new Vector3(0, 0, 0));
            }
        }
开发者ID:alittle1234,项目名称:XNA_Project,代码行数:73,代码来源:GameplayScreen.cs

示例8: PieceColllisionFunction

        public bool PieceColllisionFunction(CollisionSkin skin0, CollisionSkin skin1)
        {
            // here is handled what happens if your Object collides with another special Object (= OtherObject)
            if ((skin1.ExternalData) != null && (skin1.ExternalData) is TriangleMeshActor)
            {
                // since this instance is a 'bad guy' he deactivates 'Good Guys' when it collides with them
                if ((skin0.Owner.ExternalData) is BuildingPiece)
                {
                    //((BuildingPiece)skin0.Owner.ExternalData).Destroy();

                    BuildingPiece piece = (skin0.Owner.ExternalData) as BuildingPiece;

                    if (!piece.ContactGround)
                    {
                        cue = parentGame.soundBank.GetCue("piece_bounce");
                        AudioEmitter emmit = new AudioEmitter();
                        emmit.Position = piece.position;
                        cue.Apply3D(listener, emmit);
                        cue.Play();
                    }
                    piece.ContactGround = true;
                }

                return true;
            }
            //else
            //{
            //    if ((skin0.Owner.ExternalData) is BuildingPiece)
            //    {
            //        BuildingPiece piece = (skin0.Owner.ExternalData) as BuildingPiece;
            //        piece.ContactGround = false;
            //    }
            //    return true;
            //}

            return true;
        }
开发者ID:alittle1234,项目名称:XNA_Project,代码行数:37,代码来源:GameplayScreen.cs

示例9: Update

        public void Update(GameTime gameTime)
        {
            if (currentMusic == null)
            {
                currentMusic = soundBank.GetCue(GetRandomTrack(currentPlaylist));
                //Fake 3D Sound for Surround Effect ;)
                currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
                currentMusic.Play();
                popUpText.Text = currentPlaylist[currentMusic.Name];
                StartPopUp();
            }
            if (currentMusic.IsStopped)
            {
                currentMusicindex++;
                if (currentMusicindex >= playList.Keys.Count)
                    currentMusicindex = 0;
                currentMusic = soundBank.GetCue(GetRandomTrack(currentPlaylist));
                currentMusic.Apply3D(new AudioListener(), new AudioEmitter());
                currentMusic.Play();
                popUpText.Text = currentPlaylist[currentMusic.Name];
                StartPopUp();
            }
            if (transition)
            {
                oldVolume -= gameTime.GetElapsedTotalSecondsFloat();
                oldVolume = MathHelper.Clamp(oldVolume, 0, options.MusicVolumeFloat);
                currentVolume += gameTime.GetElapsedTotalSecondsFloat();
                if (currentVolume >= options.MusicVolumeFloat)
                {
                    transition = false;
                    currentVolume = MathHelper.Clamp(currentVolume, 0, options.MusicVolumeFloat);
                    oldCategory.Stop(AudioStopOptions.Immediate);
                    oldMusic.Stop( AudioStopOptions.Immediate);
                }
                oldCategory.SetVolume(oldVolume);
                currentCategory.SetVolume(currentVolume);
            }
            if (popUpActive)
            {
                if (popUpFloatIn)
                {
                    popUp.Y += (int)(popUpSpeed * gameTime.GetElapsedTotalSecondsFloat());
                    AlignPopUpText();
                    if (popUp.Y >= 0)
                    {
                        popUpFloatIn = false;
                    }
                }
                else
                {
                    popUpStillStandelpasedTime += gameTime.GetElapsedTotalSecondsFloat();
                    if (popUpStillStandelpasedTime >= popUpStillStandThreshold)
                    {
                        popUp.Y-= (int)(popUpSpeed * gameTime.GetElapsedTotalSecondsFloat());
                        if (popUp.X <= -(int)(options.Resolution.ScreenHeight * 0.1))
                            popUpActive = false;
                        AlignPopUpText();
                    }
                }

            }
        }
开发者ID:pampersrocker,项目名称:STAR,代码行数:62,代码来源:Music.cs

示例10: Apply3D

 public static void Apply3D(Cue cue, AudioEmitter emitter)
 {
     cue.Apply3D(AudioListener.GetClosestListener(emitter.Position), emitter);
 }
开发者ID:kernelbitch,项目名称:Lemma,代码行数:4,代码来源:AudioListener.cs


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