public void MoveBalloonOffscreen(ClientBalloon balloon, Direction direction, float exitHeight, Vector2 velocity) { Console.WriteLine("Sending balloon away!"); // Did we already notify the server that the balloon is off-screen? if (balloon.OffScreen) { return; } // notify the server that the balloon is moving off-screen m_conn.SendMessage(new ChangeScreenMessage(balloon.ID, direction, exitHeight, new Vector2D(velocity.X, velocity.Y))); balloon.OffScreen = true; }
private void ApplyBucketToBalloon(Bucket bucket, ClientBalloon balloon) { //Note to Lauren: Place your balloon bucket stuff here (in case the name wasn't descriptive enough :P) Console.WriteLine("Bucket {0} collided with ballon {1}", bucket.ID, balloon.ID); }
public void OnNewBalloon(NewBalloonMessage m) { // Choose where to place the balloon Vector2 position = new Vector2(); switch (m.Direction) { case Direction.Left: position.X = balloonTexture.Width * -1; break; case Direction.Right: position.X = balloonTexture.Width + screenDimensions.X; break; case Direction.Any: default: position.X = new Random().Next((int)screenDimensions.X); break; } position.Y = m.Y * screenDimensions.Y; // Setup the balloon's body. Body balloonBody = BodyFactory.CreateCircle(_world, 128f / (2f * MeterInPixels), 1f, PixelToWorld(position)); balloonBody.BodyType = BodyType.Dynamic; balloonBody.Restitution = 0.3f; balloonBody.Friction = 0.5f; balloonBody.LinearDamping = 1.0f; Vector2 velocity = new Vector2(m.Velocity.X, m.Velocity.Y); balloonBody.ApplyLinearImpulse(velocity * balloonBody.Mass); ClientBalloon b = new ClientBalloon(m.BalloonID, balloonBody); balloons.Add(b.ID, b); }