예제 #1
0
        public void OnPong(IObjectConnection connection, PongObject pongObject)
        {
            var info = Connections[connection];

            info.HasPonged = true;
            info.LastTicks = DateTime.Now.Ticks;
        }
예제 #2
0
 public static void AddObject(String Type, PongObject Obj)
 {
     if (!Objects.ContainsKey(Type))
     {
         Objects.Add(Type, new LinkedList <PongObject>());
     }
     Objects[Type].AddLast(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 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
        }
예제 #5
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
        }
예제 #6
0
 public static bool RemoveObject(String Type, PongObject Obj)
 {
     return(Objects[Type].Remove(Obj));
 }
예제 #7
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;
        }