Beispiel #1
0
 public Sounds(Game game, GameMode gameMode)
     : base(game)
 {
     this.gameMode = gameMode;
     // TODO: Construct any child components here
     prevLens = gameMode.ActiveLens;
 }
Beispiel #2
0
 public Stalker(Game1 game, GameMode gm)
     : base(game)
 {
     // TODO: Construct any child components here
     Size = Vector3.One/4;
     Position = Vector3.Zero;
     _gameMode = gm;
     prevLens = gm.ActiveLens;
 }
Beispiel #3
0
 /// <summary>
 /// Allows the component to run logic such as updating the world,
 /// checking for collisions, gathering input and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public override void Update(GameTime gameTime)
 {
     // TODO: Add your update logic here
     Player player = _gameMode.Player;
     float distToPlayer = _maxDist;
     if (_gameMode.ActiveLens != null)
     {
         distToPlayer *= _gameMode.ActiveLens.Health;
         if(_gameMode.ActiveLens.Health <= 0)
         {
             _gameMode.lives -= 1;
         }
         if(_gameMode.ActiveLens != prevLens)
         {
             angToPlayer = 180;
             prevLens = _gameMode.ActiveLens;
         }
         angToPlayer += 2/_gameMode.ActiveLens.Health;
     }
     Position = player.Position +
                new Vector3((float) Math.Cos(MathHelper.ToRadians(player.yAng+angToPlayer)), 0,
                            (float) Math.Sin(MathHelper.ToRadians(player.yAng+angToPlayer)))*distToPlayer;
     //float idealAng = (float)random.Next(0, 360);
     base.Update(gameTime);
 }
Beispiel #4
0
 /// <summary>
 /// Allows the game component to update itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public override void Update(GameTime gameTime)
 {
     // TODO: Add your update code here
     Lens currentLens = gameMode.ActiveLens;
     if (currentLens != prevLens)
     {
         transition.Play();
         if (currentLens is RedLens)
         {
             MediaPlayer.Play(red);
             activeSong = red;
         }
         else if (currentLens is GreenLens)
         {
             MediaPlayer.Play(green);
             activeSong = green;
         }
         else if (currentLens is BlueLens)
         {
             MediaPlayer.Play(blue);
             activeSong = blue;
         }
         else
         {
             MediaPlayer.Play(white);
             activeSong = white;
         }
     }
     prevLens = currentLens;
     base.Update(gameTime);
 }