public PlayerShip(Game game, Vector2 position) { Game = game; _soundBank = Game.Services.GetService<SoundBank[]>(); _world = Game.Services.GetService<World>(); krypton = Game.Services.GetService<KryptonEngine>(); thrustLR = _soundBank[0].GetCue("thrust01"); thrustLR.Play(); thrustLR.Pause(); thrustUD = _soundBank[0].GetCue("thrust01"); thrustUD.Play(); thrustUD.Pause(); Position = position; _particleRenderer = Game.Services.GetService<SpriteBatchRenderer>(); //_textures = Game.Services.GetService<Textures>(); //Loadcontentstuff _shiptxture = Game.Content.Load<Texture2D>("player_ship"); _turretTxture = Game.Content.Load<Texture2D>(".\\guns\\turret01"); _centreVect = new Vector2(_shiptxture.Width / 2, _shiptxture.Height / 2); ProximityBox = new Rectangle(0, 0, _shiptxture.Width+Globals.PhysBuffer, _shiptxture.Height + Globals.PhysBuffer); //make ship fixture in for farseer box = BodyFactory.CreateCircle(_world, ConvertUnits.ToSimUnits(_shiptxture.Width / 2), 7.0f); box.BodyType = BodyType.Dynamic; box.Restitution = 0.5f; box.Friction = 0.2f; box.FixedRotation = true; box.LinearDamping = 0.4f; box.Position = ConvertUnits.ToSimUnits(Position.X + _centreVect.X, Position.Y + _centreVect.Y); box.UserData = "player"; //box.OnCollision += Collide; box.OnSeparation += Collide; //make light in krypton var mLightTexture = LightTextureBuilder.CreateConicLight(Game.GraphicsDevice, 256, 2.0f); light = CreateLights(mLightTexture,400); var mLightTexture2 = LightTextureBuilder.CreatePointLight(Game.GraphicsDevice, 64); light2 = CreateLights(mLightTexture2,200); //set up thruster particle _thrustparticle = Game.Content.Load<ParticleEffect>(".\\mercury\\thruster"); _thrustparticle.LoadContent(Game.Content); _thrusterEmitter = (ConeEmitter)_thrustparticle[0]; //_thrusterEmitter.Initialise(); _thrusterEmitter.ParticleTexture = Game.Content.Load<Texture2D>(".\\mercury\\Particle004"); _thrustparticle.Initialise(); _particleRenderer.LoadContent(Game.Content); //_centerVect = new Vector2(_shiptxture.Width / 2,_shiptxture.Width / 2); currentWeapon = new Gun(Game, true, BulletsStats.Plasma01); }
public AudioManager(Game1 game) : base(game) { myGame = game; events = new List<Event>(); game.mediator.register(this, MyEvent.C_ATTACK_BULLET_END, MyEvent.M_BITE, MyEvent.G_GameOver); audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb"); trackCue = soundBank.GetCue("Cowboy"); trackCue.Play(); trackCue.Pause(); }
private void pararMusica(Cue value) { if (value.IsPlaying) value.Pause(); }
public static void pauseSound(Cue s) { PSound = s; PSound.Pause(); }
public void Pause(Cue cue) { if (cue.IsPaused) { cue.Resume(); } else if (cue.IsPlaying) { cue.Pause(); } else { // If stopped, create a new cue. cue = soundBank.GetCue(cue.Name); cue.Play(); } }
public Player( GameplayScreen screen, int playerNumber, PlayerIndex playerIndex, Avatar avatar, Vector2 pos, uint id ) : base(screen) { WheelModel = screen.Content.Load<CustomModel>( "Models/hamsterBall" ); foreach ( CustomModelSample.CustomModel.ModelPart part in WheelModel.ModelParts ) { part.Effect.CurrentTechnique = part.Effect.Techniques["Color"]; part.Effect.Parameters["Color"].SetValue( new Vector4( .8f, .7f, 1f, .225f ) ); part.Effect.Parameters["SpecularPower"].SetValue( 400 ); part.Effect.Parameters["Mask"].SetValue( MaskHelper.MotionBlur( 1 ) ); } DrawOrder = 8; WinState = PlayerWinState.None; soundPosition = Vector3.Zero; soundVelocity = Vector3.Zero; float depth = screen.Camera.Position.Z; DeathLine = depth * (float)Math.Tan( screen.Camera.Fov / 2f ); RespawnTime = float.MaxValue; shrinkBegin = 0; Scale = 1f; ScaleSpring = new SpringInterpolater( 1, 200, SpringInterpolater.GetCriticalDamping( 200 ) ); ScaleSpring.Active = true; ScaleSpring.SetSource( Scale ); ScaleSpring.SetDest( Scale ); PlayerIndex = playerIndex; PlayerNumber = playerNumber; BoostBurnRate = 1f; BoostRechargeRate = .25f; Avatar = avatar; BoundingCircle = new PhysCircle( Size / 2f, pos, 10f ); BoundingCircle.Parent = this; BoundingCircle.Elasticity = .4f; BoundingCircle.Friction = .5f; BoundingCircle.Collided += HandleCollision; BoundingCircle.Responded += HandleCollisionResponse; screen.PhysicsSpace.AddBody( BoundingCircle ); walkAnim = CustomAvatarAnimationData.GetAvatarAnimationData( "Walk", Screen.Content ); runAnim = CustomAvatarAnimationData.GetAvatarAnimationData( "Run", Screen.Content ); // pre-load animations for podium screen avatar.SetAnimation( AvatarAnimationPreset.Celebrate ); avatar.SetAnimation( AvatarAnimationPreset.Clap ); avatar.SetAnimation( AvatarAnimationPreset.FemaleAngry ); avatar.SetAnimation( AvatarAnimationPreset.MaleCry ); standAnim = (AvatarAnimationPreset)( (int)AvatarAnimationPreset.Stand0 + random.Next( 8 ) ); avatar.SetAnimation( standAnim ); if ( playerIndex >= PlayerIndex.One ) { HUD = new PlayerHUD( this, SignedInGamer.SignedInGamers[playerIndex] ); } else { HUD = new PlayerHUD( this, null ); playerAI = new PlayerAI( this ); } vertexDeclaration = new VertexDeclaration( screen.ScreenManager.GraphicsDevice, VertexPositionNormalTexture.VertexElements ); boosterSound = GameCore.Instance.AudioManager.Play2DCue( "booster", 1f ); boosterSound.Pause(); glow = new CircularGlow( new Vector3( BoundingCircle.Position, 0 ), Color.OrangeRed, Size ); glow.Player = this; screen.ObjectTable.Add( glow ); glowSpring = new SpringInterpolater( 1, 500, .75f * SpringInterpolater.GetCriticalDamping( 500 ) ); glowSpring.Active = true; glowSpring.SetSource( 0 ); glowSpring.SetDest( 0 ); Tag = new PlayerTag( this, screen.Content.Load<SpriteFont>( "Fonts/playerTagFont" ) ); SetID( id ); }