Пример #1
0
 public void Update(DiskPlayer player)
 {
     Transform = Matrix.CreateTranslation(C.screenWidth * 0.5f, C.screenHeight * 0.5f, 0)
                 //* Matrix.CreateRotationZ(player.rotation)
                 * Matrix.CreateScale(scale)
                 * Matrix.CreateTranslation(-player.position.X, -player.position.Y, 0);
 }
Пример #2
0
 public void Collide(DiskPlayer player)
 {
     foreach (SegmentObst segment in segments)
     {
         segment.Collide(player);
     }
 }
Пример #3
0
        public void Collide(DiskPlayer player)
        {
            if (Vector2.Distance(position, player.position) >= radius + player.radius)
            {
                return;
            }

            Vector2 dir = player.position - position;

            dir.Normalize();

            player.position = position + dir * (radius + player.radius);
            //player.velocity -= dir * Vector2.Dot(dir, player.velocity);
        }
Пример #4
0
        public void Collide(DiskPlayer player)
        {
            float t = Vector2.Dot(dir, player.Position - startPos);

            if (t < 0)
            {
                startDisk.Collide(player);
                return;
            }
            if (t > length)
            {
                endDisk.Collide(player);
                return;
            }
            DiskObst temp = new DiskObst(startPos + t * dir, radius, 0, "disk", Color.White);

            temp.Collide(player);
        }