コード例 #1
0
ファイル: GameScreen.cs プロジェクト: Frib/LD24
        internal override void AddPhotoData(Photograph pg)
        {
            CanTakePhoto = false;
            RM.PlaySound("snap");
            timer = 60;

            BoundingFrustum bf = new BoundingFrustum(camera.View * camera.ZoomProjection);
            var entities = island.GetEntitiesInView(bf);
            Console.WriteLine(entities.Count());
            var bird = entities.OfType<Bird>().OrderBy(x => (x.Position - island.player.Position).Length()).FirstOrDefault();
            if (bird != null)
            {
                pg.Bird = bird;
                pg.animation = bird.animation;
                pg.Distance = (bird.Position - island.player.Position).Length();
                pg.Splash = entities.OfType<SplashEffect>().Any();
                pg.Heading = bird.GetHeading();
                pg.Zoom = camera.cameraZoom;
                Encyclopedia.AddBird(bird);
            }

            if (pg.CalculateScore() > HiScore)
            {
                HiScore = pg.CalculateScore();
            }
            Console.Write(pg.ToString());
        }
コード例 #2
0
ファイル: G.cs プロジェクト: Frib/LD24
        protected override void Update(GameTime gameTime)
        {
            IM.NewState();

            currentScreen.Update();
            if (currentScreen.CanTakePhoto && RM.IsDown(InputAction.AltFire) && RM.IsPressed(InputAction.Fire))
            {
                int scale = 2;
                RenderTarget2D screenshot = new RenderTarget2D(GraphicsDevice, 800 * scale, 600 * scale, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
                GraphicsDevice.Clear(Color.Black);
                GraphicsDevice.SetRenderTarget(screenshot);
                GraphicsDevice.Clear(Color.CornflowerBlue);
                currentScreen.Draw();
                GraphicsDevice.SetRenderTarget(null);

                Color[] data = new Color[320 * 240 * scale * scale];
                screenshot.GetData<Color>(0, new Rectangle(240 * scale, 180 * scale, 320 * scale, 240 * scale), data, 0, data.Length);
                Texture2D shot = new Texture2D(GraphicsDevice, 320 * scale, 240 * scale);
                shot.SetData<Color>(data);
                Photograph pg = new Photograph(shot);
                photos.Add(pg);
                screenshot.Dispose();

                currentScreen.AddPhotoData(pg);
            }

            base.Update(gameTime);
        }
コード例 #3
0
ファイル: PhotoDetailScreen.cs プロジェクト: Frib/LD24
 public PhotoDetailScreen(Photograph photograph, PhotoAlbum photoAlbum)
 {
     this.photograph = photograph;
     this.photoAlbum = photoAlbum;
 }
コード例 #4
0
ファイル: PhotoInfoScreen.cs プロジェクト: Frib/LD24
 public PhotoInfoScreen(Photograph photograph, PhotoAlbum photoAlbum)
 {
     this.photograph = photograph;
     this.photoAlbum = photoAlbum;
     name = Encyclopedia.GetName(photograph.Bird);
 }
コード例 #5
0
ファイル: Screen.cs プロジェクト: Frib/LD24
 internal virtual void AddPhotoData(Photograph pg)
 {
 }