/// <summary> /// Checks the collision sphere. /// </summary> /// <param name="theOther">The other.</param> public void CheckCollisionSphere(Objet2D theOther) { if (sphereCollision.Intersects(theOther.SphereCollision)) { alive = false; } }
/// <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(); } }
/// <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); }
/// <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; }
protected bool IsEnemyBullet(Objet2D objet) { if (objet.GetType() == typeof (Bullet)) { return true; } return false; }
/// <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; }
protected bool IsPlayer(Objet2D objet) { if (objet.GetType() == typeof(PlayerShip)) { return true; } return false; }
protected bool IsEnemyBullet(Objet2D objet) { if (objet.GetType() == typeof(Bullet)) { return(true); } return(false); }
protected bool IsPlayer(Objet2D objet) { if (objet.GetType() == typeof(PlayerShip)) { return(true); } return(false); }
/// <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); }
/// <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(); } } }
/// <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(); } } }
public abstract void CheckCollisionBox(Objet2D theOther);
public override void CheckCollisionBox(Objet2D theOther) { // override if needed }
public override void CheckCollisionBox(Objet2D theOther) { }