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