示例#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);