Пример #1
0
 public static void AddObject(String Type, PongObject Obj)
 {
     if (!Objects.ContainsKey(Type))
     {
         Objects.Add(Type, new LinkedList<PongObject>());
     }
     Objects[Type].AddLast(Obj);
 }
Пример #2
0
 public static bool RemoveObject(String Type, PongObject Obj)
 {
     return Objects[Type].Remove(Obj);
 }
Пример #3
0
 public void PaddleHitsPowerupBubble(PongObject param1, PongObject param2)
 {
     PowerupBubble p = (PowerupBubble)param1;
     p.powerup.Activate();
     p.IsActive = false;
     particles.CreateBubblePopEffect(new Vector2(p.Position.X + p.Radius, p.Position.Y + p.Radius));
 }
Пример #4
0
 /// <summary>
 /// Collision callback for PowerupBubble and Wall
 /// </summary>
 /// <param name="param1"></param>
 /// <param name="param2"></param>
 public void BouncePowerupBubbleOffWall(PongObject param1, PongObject param2)
 {
     PowerupBubble p = (PowerupBubble)param1;
     p.Velocity.X *= -1.0f;
 }
Пример #5
0
        /// <summary>
        /// Collision callback for Ball and Wall
        /// </summary>
        /// <param name="param1"></param>
        /// <param name="param2"></param>
        public void BounceBallOffWall(PongObject param1, PongObject param2)
        {
            Ball b = (Ball)param1;
            Wall w = (Wall)param2;
            b.Velocity.X = -b.Velocity.X;
            particles.CreateDefaultCollisionEffect(new Vector2(b.Position.X + b.Radius, b.Position.Y + b.Radius));

            //pew
        }
Пример #6
0
        /// <summary>
        /// Collision callback for Ball and Paddle
        /// </summary>
        /// <param name="param1"></param>
        /// <param name="param2"></param>
        public void BounceBallOffPaddle(PongObject param1, PongObject param2)
        {
            Ball b = (Ball)param1;
            Paddle p = (Paddle)param2;
            //TODO: incorporate spin and also whether or not we hit the rounded part
            b.Velocity.Y = -b.Velocity.Y;
            particles.CreateDefaultCollisionEffect(new Vector2(b.Position.X + b.Radius, b.Position.Y + b.Radius));

            //Sound pong or ping here
        }