MyGame.FirstAidManager.checkCollisionWithBullet C# (CSharp) Method

checkCollisionWithBullet() public method

if the unit(player or bullet) collide with the first aid add the health
public checkCollisionWithBullet ( Unit unit ) : bool
unit Unit Unit to check collision with
return bool
        public bool checkCollisionWithBullet(Unit unit)
        {
            // If shot is still in play, check for collisions
            for (int j = 0; j < firstAidKits.Count; ++j)
            {
                if (unit.collideWith(firstAidKits[j].unit))
                {
                    addHealth(j);
                    return true;
                }
            }
            return false;
        }

Usage Example

コード例 #1
0
 public bool checkCollisionWithBullet(Unit unit)
 {
     return(monsters.checkCollisionWithBullet(unit) || firstAidManger.checkCollisionWithBullet(unit));
 }