Пример #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;
     }
 }
Пример #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();
     }
 }
Пример #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);
 }
Пример #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;
 }
Пример #5
0
 protected bool IsEnemyBullet(Objet2D objet)
 {
     if (objet.GetType() == typeof (Bullet))
     {
         return true;
     }
     return false;
 }
Пример #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;
 }
Пример #7
0
 protected bool IsPlayer(Objet2D objet)
 {
     if (objet.GetType() == typeof(PlayerShip))
     {
         return true;
     }
     return false;
 }
Пример #8
0
 protected bool IsEnemyBullet(Objet2D objet)
 {
     if (objet.GetType() == typeof(Bullet))
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
 protected bool IsPlayer(Objet2D objet)
 {
     if (objet.GetType() == typeof(PlayerShip))
     {
         return(true);
     }
     return(false);
 }
Пример #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);
 }
Пример #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();
         }
     }
 }
Пример #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();
         }
     }
 }
Пример #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();
         }
     }
 }
Пример #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();
     }
 }
Пример #15
0
 public abstract void CheckCollisionBox(Objet2D theOther);
Пример #16
0
 public override void CheckCollisionBox(Objet2D theOther)
 {
     // override if needed
 }
Пример #17
0
 public override void CheckCollisionBox(Objet2D theOther)
 {
 }
Пример #18
0
 public override void CheckCollisionBox(Objet2D theOther)
 {
     // override if needed
 }
Пример #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();
         }
     }
 }
Пример #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;
     }
 }
Пример #21
0
 public abstract void CheckCollisionBox(Objet2D theOther);