Exemplo n.º 1
0
 /// <summary>
 /// Checks the collision sphere.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public void CheckCollisionSphere(Objet2D theOther)
 {
     if (sphereCollision.Intersects(theOther.SphereCollision))
     {
         alive = false;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Checks the collision box.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public override void CheckCollisionBox(Objet2D theOther)
 {
     if (this.boiteCollision.Intersects(theOther.BoiteCollision))
     {
         this.NotifyAllObservers();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Determines whether the object is an enemy ship.
 /// </summary>
 /// <param name="objet">The objet.</param>
 /// <returns></returns>
 protected bool IsEnemyShip(Objet2D objet)
 {
     if (objet.GetType() == typeof(LittleShip) || objet.GetType() == typeof(BigShip) || objet.GetType() == typeof(BigBossShip))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Determines whether the specified objet is asteroid.
 /// </summary>
 /// <param name="objet">The objet.</param>
 /// <returns></returns>
 protected bool IsAsteroid(Objet2D objet)
 {
     if (objet.GetType() == typeof(Asteroid))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 5
0
 protected bool IsEnemyBullet(Objet2D objet)
 {
     if (objet.GetType() == typeof (Bullet))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Determines whether the object is an enemy ship.
 /// </summary>
 /// <param name="objet">The objet.</param>
 /// <returns></returns>
 protected bool IsEnemyShip(Objet2D objet)
 {
     if (objet.GetType() == typeof(LittleShip) || objet.GetType() == typeof(BigShip) || objet.GetType() == typeof(BigBossShip))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 7
0
 protected bool IsPlayer(Objet2D objet)
 {
     if (objet.GetType() == typeof(PlayerShip))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 8
0
 protected bool IsEnemyBullet(Objet2D objet)
 {
     if (objet.GetType() == typeof(Bullet))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 9
0
 protected bool IsPlayer(Objet2D objet)
 {
     if (objet.GetType() == typeof(PlayerShip))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Determines whether the specified objet is asteroid.
 /// </summary>
 /// <param name="objet">The objet.</param>
 /// <returns></returns>
 protected bool IsAsteroid(Objet2D objet)
 {
     if (objet.GetType() == typeof(Asteroid))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Checks the collision box.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public override void CheckCollisionBox(Objet2D theOther)
 {
     if ((IsAsteroid(theOther) && currentBonus.Type != BonusType.invincible) || (IsEnemyShip(theOther) && currentBonus.Type != BonusType.invincible) || (IsEnemyBullet(theOther) && currentBonus.Type != BonusType.invincible))
     {
         if (boiteCollision.Intersects(theOther.BoiteCollision) && alive)
         {
             playerDead();
             ship.NotifyAllObservers();
         }
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Checks the collision box that is hit by the bullet.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public override void CheckCollisionBox(Objet2D theOther)
 {
     if (this.isShooted)
     {
         if (boiteCollision.Intersects(theOther.BoiteCollision))
         {
             if (base.IsAsteroid(theOther))
             {
                 (theOther as Asteroid).Split(this.rotationAngle);
             }
             if (IsEnemyShip(theOther))
             {
                 (theOther as EnemyShip).LoseLife();
             }
             if (isEnemyBullet && IsPlayer(theOther))
             {
                 (theOther as PlayerShip).PlayerTotalLife -= 1;
             }
             resetBullet();
         }
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// Checks the collision box that is hit by the bullet.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public override void CheckCollisionBox(Objet2D theOther)
 {
     if (this.isShooted)
     {
         if (boiteCollision.Intersects(theOther.BoiteCollision))
         {
             if (base.IsAsteroid(theOther))
             {
                 (theOther as Asteroid).Split(this.rotationAngle);
             }
             if (IsEnemyShip(theOther))
             {
                 (theOther as EnemyShip).LoseLife();
             }
             if (isEnemyBullet && IsPlayer(theOther))
             {
                 (theOther as PlayerShip).PlayerTotalLife -= 1;
             }
             resetBullet();
         }
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Checks the collision box.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public override void CheckCollisionBox(Objet2D theOther)
 {
     if (this.boiteCollision.Intersects(theOther.BoiteCollision))
     {
         this.NotifyAllObservers();
     }
 }
Exemplo n.º 15
0
 public abstract void CheckCollisionBox(Objet2D theOther);
Exemplo n.º 16
0
 public override void CheckCollisionBox(Objet2D theOther)
 {
     // override if needed
 }
Exemplo n.º 17
0
 public override void CheckCollisionBox(Objet2D theOther)
 {
 }
Exemplo n.º 18
0
 public override void CheckCollisionBox(Objet2D theOther)
 {
     // override if needed
 }
Exemplo n.º 19
0
 /// <summary>
 /// Checks the collision box.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public override void CheckCollisionBox(Objet2D theOther)
 {
     if ((IsAsteroid(theOther) && currentBonus.Type != BonusType.invincible) || (IsEnemyShip(theOther) && currentBonus.Type != BonusType.invincible) || (IsEnemyBullet(theOther) && currentBonus.Type != BonusType.invincible))
     {
         if (boiteCollision.Intersects(theOther.BoiteCollision) && alive)
         {
             playerDead();
             ship.NotifyAllObservers();
         }
     }
 }
Exemplo n.º 20
0
 /// <summary>
 /// Checks the collision sphere.
 /// </summary>
 /// <param name="theOther">The other.</param>
 public void CheckCollisionSphere(Objet2D theOther)
 {
     if (sphereCollision.Intersects(theOther.SphereCollision))
     {
         alive = false;
     }
 }
Exemplo n.º 21
0
 public abstract void CheckCollisionBox(Objet2D theOther);