Exemple #1
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     if (collisionData.ObjectCollisionGroupString == "bullet")
     {
         this.IsDestroyed = true;
     }
 }
Exemple #2
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     this.IsDestroyed = true;
 }
Exemple #3
0
        public override void RespondToCollision(CollisionData collisionData)
        {
            //If there is a collision the player must stop moving.
            this.Direction = new GridPosition(0, 0);

            //If the player is hit by a bullet
            if (collisionData.ObjectCollisionGroupString == "bullet")
            {
                //If the player has more health than the damage which the bullet does.
                if (this.Health > Bullet.Damage)
                {
                    this.Health -= Bullet.Damage;
                }
                    //Otherwise the player dies.
                else
                {
                    this.IsDestroyed = true;
                }
            }
                //If the player hits a score block, the score bonus is added to the player's score.
            else if (collisionData.ObjectCollisionGroupString == "scoreBlock")
            {
                this.Score += (int)(collisionData.ObjectImage - '0');
            }
                //If the player hits a health block, the health bonus is added to the player's health.
                //The current health of the player + the health bonus must not exceed the maximum health a player can have.
            else if (collisionData.ObjectCollisionGroupString == "healthBlock")
            {
                this.Health = Math.Min(Player.PlayerMaxHealth, this.Health + HealthBlock.HealthBonus);
            }
        }
Exemple #4
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     this.Direction = new GridPosition(0, 0);
     this.IsDestroyed = true;
 }
Exemple #5
0
 public virtual void RespondToCollision(CollisionData collisionData)
 {
 }
Exemple #6
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     this.IsDestroyed = true;
 }