コード例 #1
0
ファイル: GamePage.xaml.cs プロジェクト: xwiz/hackathonGame
        private void LayoutRootManipulationStarted(object sender, ManipulationStartedEventArgs e)
        {
            BehaviorCollection behaviorCollection = Interaction.GetBehaviors(_finger);

            if (behaviorCollection.Count == 0)
            {
                behaviorCollection.Add(new PhysicsObjectBehavior
                {
                    BoundaryElement = "finger", IsStatic = true, IsSensor = true
                });
                _physicsController.AddPhysicsBody(
                    _finger.GetValue(PhysicsObjectMain.PhysicsObjectProperty) as PhysicsObjectMain);
            }


            PhysicsSprite finger = _physicsController.PhysicsObjects["finger"];


            finger.Collision += FingerCollision;
            finger.BodyObject.OnSeparation += BodyObject_OnSeparation;

            //finger phys object already created
            if (finger != null)
            {
                finger.Position = new Vector2((float)(e.ManipulationOrigin.X),
                                              (float)(e.ManipulationOrigin.Y));
            }



            e.Handled = true;
        }
コード例 #2
0
 void controller_Initialized(object source)
 {
     Controller.AddPhysicsBody(_physicsObjectMain);
 }