/// <summary> /// Check if the pipe set is colliding with the character or not. /// </summary> /// <returns></returns> public bool IsColliding(PipeSet nextPipeSet) { for (var i = 0; i < colliders.Length; ++i) { var collider = colliders[i]; collider.X = colliders[i].X + position.X - agentWidth / 2; collider.Y = colliders[i].Y + position.Y - agentHeight / 2; if (collider.Intersects(nextPipeSet.GetTopPipeCollider())) //collider.Intersects(nextPipeSet.GetBottomPipeCollider()) || { return(true); } } return(false); }
/// <summary> /// Check if the pipe set is colliding with the character or not. /// </summary> /// <returns></returns> public bool IsColliding(PipeSet nextPipeSet) { for (var i=0; i<colliders.Length; ++i) { var collider = colliders[i]; collider.X = colliders[i].X + position.X - agentWidth / 2; collider.Y = colliders[i].Y + position.Y - agentHeight / 2; if (collider.Intersects(nextPipeSet.GetBottomPipeCollider()) || collider.Intersects(nextPipeSet.GetTopPipeCollider())) return true; } return false; }