コード例 #1
0
ファイル: Ship.cs プロジェクト: vizkidd/MonoGame-StarterKits
 /// <summary>
 /// Place this ship in the world.
 /// </summary>
 /// <param name="findSpawnPoint">
 /// If true, the actor's position is changed to a valid, non-colliding point.
 /// </param>
 public override void Spawn(bool findSpawnPoint)
 {
     // do not call the base Spawn, as the actor never is added or removed when
     // dying or respawning, because we always need to be processing input
     // respawn this actor
     if (dead == true)
     {
         // I LIVE
         dead = false;
         // find a new spawn point if requested
         if (findSpawnPoint)
         {
             position = world.FindSpawnPoint(this);
         }
         // reset the velocity
         velocity = Vector2.Zero;
         // reset the shield and life values
         life   = 25f;
         shield = shieldMaximum;
         // reset the safety timers
         safeTimer = safeTimerMaximum;
         // create the default weapons
         weapon     = new LaserWeapon(this);
         mineWeapon = new MineWeapon(this);
         // play the ship-spawn cue
         world.AudioManager.PlayCue("playerSpawn");
         // add a particle effect at the ship's new location
         world.ParticleSystems.Add(new ParticleSystem(this.position,
                                                      Vector2.Zero, 32, 32f, 64f, 2f, 0.1f, new Color[] { this.color }));
         // remind the player that we're spawning
         FireGamepadMotors(0.25f, 0f);
     }
 }
コード例 #2
0
ファイル: Ship.cs プロジェクト: kfarrell/MonoGame-StarterKits
 /// <summary>
 /// Place this ship in the world.
 /// </summary>
 /// <param name="findSpawnPoint">
 /// If true, the actor's position is changed to a valid, non-colliding point.
 /// </param>
 public override void Spawn(bool findSpawnPoint)
 {
     // do not call the base Spawn, as the actor never is added or removed when
     // dying or respawning, because we always need to be processing input
     // respawn this actor
     if (dead == true)
     {
         // I LIVE
         dead = false;
         // find a new spawn point if requested
         if (findSpawnPoint)
         {
             position = world.FindSpawnPoint(this);
         }
         // reset the velocity
         velocity = Vector2.Zero;
         // reset the shield and life values
         life = 25f;
         shield = shieldMaximum;
         // reset the safety timers
         safeTimer = safeTimerMaximum;
         // create the default weapons
         weapon = new LaserWeapon(this);
         mineWeapon = new MineWeapon(this);
         // play the ship-spawn cue
         world.AudioManager.PlayCue("playerSpawn");
         // add a particle effect at the ship's new location
         world.ParticleSystems.Add(new ParticleSystem(this.position,
             Vector2.Zero, 32, 32f, 64f, 2f, 0.1f, new Color[] { this.color }));
         // remind the player that we're spawning
         FireGamepadMotors(0.25f, 0f);
     }
 }