Beispiel #1
0
        public override bool collide(cCritter pcritter)
        {
            if (pcritter.IsKindOf("KnockbackBullet"))
            {
                return(false);
            }

            bool collided = base.collide(pcritter);

            if (Player.Shield)
            {
                pcritter.damage(5);
            }
            return(collided);
        }
Beispiel #2
0
 /// <summary>
 /// This function checks if it has hit a target.  If it has, the damage function is called on the target,
 /// and the bullet dies.  The hit score is returned from the damage function and added to the shooter's
 /// score using addScore.
 /// </summary>
 /// <param name="pcritter">The critter being tested for the bullet's target.</param>
 /// <returns></returns>
 public override bool collide(cCritter pcritter)
 {
     //If you hit a target, damage it and die.
     if (_baseAccessControl == 1)
     {
         return(base.collide(pcritter));
     }
     if (isTarget(pcritter))
     {
         if (!touch(pcritter))
         {
             return(false);
         }
         int hitscore = pcritter.damage(_hitstrength);
         delete_me();           //Makes a service request, but you won't go away yet.
         if (_pshooter != null) //Possible that _pshooter has died, is NULL.
         {
             _pshooter.addScore(hitscore);
         }
         return(true);
     }
     //Bounce off or everything else.
     return(base.collide(pcritter)); //Bounce off non-target critters
 }