public new bool HasCollidedWithPlayer(SpriteUV player) //Check if the a sprite has hit a part of the maze { if (tileIndex > 5 && tileIndex < 15) { laserOn = true; } else { laserOn = false; } Bounds2 playerBounds = player.GetlContentLocalBounds(); player.GetContentWorldBounds(ref playerBounds); //Get sprite bounds (player bounds) Bounds2 laserBounds = sprite.GetlContentLocalBounds(); sprite.GetContentWorldBounds(ref laserBounds); //Get all of the maze bounds laserBounds.Max = laserBounds.Max - 15.0f; laserBounds.Min = laserBounds.Min + 15.0f; if (playerBounds.Overlaps(laserBounds) && laserOn) { return(true); } return(false); }
public bool HasCollidedWithPlayer(SpriteUV player) //Check if the a sprite has hit a part of the maze { if (collected == false) { Bounds2 playerBounds = player.GetlContentLocalBounds(); player.GetContentWorldBounds(ref playerBounds); //Get sprite bounds (player bounds) Bounds2 spriteBounds = sprite.GetlContentLocalBounds(); sprite.GetContentWorldBounds(ref spriteBounds); //Get all of the maze bounds if (playerBounds.Overlaps(spriteBounds)) { return(true); } } return(false); }
public new bool HasCollidedWithPlayer(SpriteUV player) //Check if the a sprite has hit a part of the maze { Bounds2 playerBounds = player.GetlContentLocalBounds(); player.GetContentWorldBounds(ref playerBounds); //Get sprite bounds (player bounds) Bounds2 holeBounds = sprite.GetlContentLocalBounds(); sprite.GetContentWorldBounds(ref holeBounds); //Get all of the maze bounds holeBounds.Max = holeBounds.Max - 15.0f; holeBounds.Min = holeBounds.Min + 15.0f; if (playerBounds.Overlaps(holeBounds)) { return(true); } return(false); }