Beispiel #1
0
 private void Collider_OnCollisionEnter(code.physics.Collider.ColliderEventArgs colliderArgs)
 {
     if (colliderArgs.Collider.parent.Tag == "Player")
     {
         parent.Shape.Visibility     = System.Windows.Visibility.Hidden;
         parent.Transform.Position.Y = -100;
     }
 }
Beispiel #2
0
 private void OnCollisionExit(code.physics.Collider.ColliderEventArgs colliderArgs)
 {
     if (colliderArgs.normal.X == 0 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
     {
         Right = false;
     }
     if (colliderArgs.normal.X == 0 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
     {
         Left = false;
     }
     if (colliderArgs.normal.Y == 0 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
     {
         Ground = false;
     }
     if (colliderArgs.normal.Y == 0 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
     {
         Top = false;
     }
 }
Beispiel #3
0
        private void OnCollisionEnter(code.physics.Collider.ColliderEventArgs colliderArgs)
        {
            if (colliderArgs.normal.Y == -1 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
            {
                Ground = true;
            }
            if (colliderArgs.normal.Y == 1 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
            {
                Top = true;
            }
            if (colliderArgs.normal.X == 1 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
            {
                Left = true;
            }
            if (colliderArgs.normal.X == -1 && colliderArgs.collider2.parent.Tag == "Player" && colliderArgs.Collider.parent.Tag != "Background" && colliderArgs.Collider.parent.Tag != "Coin")
            {
                Right = true;
            }

            if (colliderArgs.Collider.parent.Tag == "Coin")
            {
                Player.AddScore(100);
            }
        }