コード例 #1
0
ファイル: PlayerShip.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 protected bool IsEnemyBullet(Objet2D objet)
 {
     if (objet.GetType() == typeof (Bullet))
     {
         return true;
     }
     return false;
 }
コード例 #6
0
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 protected bool IsPlayer(Objet2D objet)
 {
     if (objet.GetType() == typeof(PlayerShip))
     {
         return true;
     }
     return false;
 }
コード例 #8
0
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 protected bool IsEnemyBullet(Objet2D objet)
 {
     if (objet.GetType() == typeof(Bullet))
     {
         return(true);
     }
     return(false);
 }
コード例 #9
0
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 protected bool IsPlayer(Objet2D objet)
 {
     if (objet.GetType() == typeof(PlayerShip))
     {
         return(true);
     }
     return(false);
 }
コード例 #10
0
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: PlayerShip.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: Bullet.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: Bullet.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: Bonus.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 public abstract void CheckCollisionBox(Objet2D theOther);
コード例 #16
0
ファイル: Asteroid.cs プロジェクト: willbur415/POO_TP1
 public override void CheckCollisionBox(Objet2D theOther)
 {
     // override if needed
 }
コード例 #17
0
ファイル: EnemyShip.cs プロジェクト: willbur415/POO_TP1
 public override void CheckCollisionBox(Objet2D theOther)
 {
 }
コード例 #18
0
ファイル: Asteroid.cs プロジェクト: willbur415/POO_TP1
 public override void CheckCollisionBox(Objet2D theOther)
 {
     // override if needed
 }
コード例 #19
0
ファイル: PlayerShip.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: PlayerShip.cs プロジェクト: willbur415/POO_TP1
 /// <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
ファイル: MovableObject.cs プロジェクト: willbur415/POO_TP1
 public abstract void CheckCollisionBox(Objet2D theOther);