Esempio n. 1
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     if (collisionData.ObjectCollisionGroupString == "bullet")
     {
         this.IsDestroyed = true;
     }
 }
Esempio n. 2
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     this.IsDestroyed = true;
 }
Esempio n. 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);
            }
        }
Esempio n. 4
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     this.Direction = new GridPosition(0, 0);
     this.IsDestroyed = true;
 }
Esempio n. 5
0
 public virtual void RespondToCollision(CollisionData collisionData)
 {
 }
Esempio n. 6
0
 public override void RespondToCollision(CollisionData collisionData)
 {
     this.IsDestroyed = true;
 }