Exemplo n.º 1
0
 public ButterflyPlayer(Game1 MyGame, Vector3 Position, float Rotation, Camera cam)
 {
     myGame = MyGame;
     hands = new List<ICursor>();
     hands.Add(new KinectAbsoluteScreenspaceCursor(myGame.Services.GetService(typeof(KinectService)) as KinectService, KinectAbsoluteScreenspaceCursor.Handedness.Left, myGame));
     hands.Add(new KinectAbsoluteScreenspaceCursor(myGame.Services.GetService(typeof(KinectService)) as KinectService, KinectAbsoluteScreenspaceCursor.Handedness.Right, myGame));
     kinect = myGame.Services.GetService(typeof(KinectService)) as KinectService;
     kinect.RegisterKinectListener(this);
     batch = myGame.Services.GetService(typeof(SpriteBatch)) as SpriteBatch;
     position = Position;
     rotation = Rotation;
 }
Exemplo n.º 2
0
 public ButterflyLevel(Camera Camera, ButterflyPlayer Player, Logger ErrorLogger, Game1 MyGame)
 {
     myCam = Camera;
     player = Player;
     butterflies = new List<Butterfly>();
     LevelStarting = true;
     errorLogger = ErrorLogger;
     myGame = MyGame;
     spriteQueue = new List<Tuple<Vector3, int>>();
     queueTimers = new List<int>();
     scoreStrings = new List<string>();
     playerProfile = myGame.Services.GetService(typeof(PlayerProfile)) as PlayerProfile;
 }
Exemplo n.º 3
0
        public ButterflyActivity(Game1 MyGame)
        {
            myGame = MyGame;
            content = new ContentManager(myGame.Services, "Content");
            myCamera = new Camera();
            float aspectRatio = (float)myGame.GraphicsDevice.PresentationParameters.BackBufferWidth / (float)myGame.GraphicsDevice.PresentationParameters.BackBufferHeight;
            myCamera.Perspective(90, myGame.GraphicsDevice.Viewport.AspectRatio, 0.1f, 20f);

            myCamera.Position = new Vector3(0f, 1f, -10f);
            myCamera.LookAt(new Vector3(0, 0, 0));
            player = new ButterflyPlayer(myGame, new Vector3(0f, 2f, 0) * 2, 0f, myCamera);
            errorLogger = myGame.Services.GetService(typeof(Logger)) as Logger;
            counter = -1;
        }
Exemplo n.º 4
0
        public void Draw(Camera myCam, SpriteBatch sb)
        {
            if (!hidden)
            {
                transforms = animationPlayer.GetSkinTransforms();

                // Draw the model. A model can have multiple meshes, so loop.
                foreach (ModelMesh mesh in myModel.Meshes)
                {
                    // This is where the mesh orientation is set, as well
                    // as our camera and projection.
                    foreach (SkinnedEffect effect in mesh.Effects)
                    {
                        //effect.GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap
                        effect.SetBoneTransforms(transforms);
                        effect.EnableDefaultLighting();
                        effect.PreferPerPixelLighting = true;
                        effect.World = Matrix.CreateScale(0.1f) * world;
                        effect.View = myCam.ViewMatrix;
                        effect.Projection = myCam.ProjectionMatrix;
                        effect.DiffuseColor = Microsoft.Xna.Framework.Color.White.ToVector3();
                        effect.Texture = ButterflyTextures[(int)(myColor)];
                    }
                    mesh.Draw();
                }

                //For Debugging
               // sb.Begin();
               // sb.Draw(ButterflyTextures[0], hitbox.HitArea, Microsoft.Xna.Framework.Color.White);
               // sb.End();

            }
        }
Exemplo n.º 5
0
 public void Draw(Camera cam, SpriteBatch sb)
 {
     if (kinectVideoTexture != null)
     {
         sb.Draw(kinectVideoTexture, new Rectangle(0, 0, myGame.GraphicsDevice.PresentationParameters.BackBufferWidth, myGame.GraphicsDevice.PresentationParameters.BackBufferHeight), Color.White);
     }
 }