Beispiel #1
0
		/// <summary>
		/// Constructs an instance of Completed screen with the set of pictures to put
		/// onto the photographs.
		/// </summary>
		public CompletedScreen( PictureSet pictureSet ) {
			this.pictureSet = pictureSet;

			Audio.Play( "Puzzle Completed" );
			photographs = new List<Photograph>();

			int photographCount = 40;
			for( int i = 0; i < photographCount; i++ ) {
				Photograph newphotograph = new Photograph();
				ResetPhotograph( newphotograph );
				photographs.Add( newphotograph );
			}

			TransitionOnTime = Puzzle3D.TransitionTime;
			TransitionOffTime = TimeSpan.FromSeconds( 0.75f );
		}
        /// <summary>
        /// Constructs an instance of Completed screen with the set of pictures to put
        /// onto the photographs.
        /// </summary>
        public CompletedScreen(PictureSet pictureSet)
        {
            this.pictureSet = pictureSet;

            Audio.Play("Puzzle Completed");
            photographs = new List <Photograph>();

            int photographCount = 40;

            for (int i = 0; i < photographCount; i++)
            {
                Photograph newphotograph = new Photograph();
                ResetPhotograph(newphotograph);
                photographs.Add(newphotograph);
            }

            TransitionOnTime  = Puzzle3D.TransitionTime;
            TransitionOffTime = TimeSpan.FromSeconds(0.75f);
        }
Beispiel #3
0
        public Board(int sizeX, int sizeY, bool twoSided)
        {
            this.twoSided = twoSided;
            this.width    = sizeX;
            this.height   = sizeY;

            camera = new Camera((float)Math.Max(sizeX, sizeY) * 400.0f / 5.0f);

            nextPictureSet = PictureDatabase.GetNextPictureSet(twoSided ? 2 : 1);

            this.layout = new Chip[Width, Height];
            this.boardPositionMatrices = new Matrix[Width, Height];

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++)
                {
                    Chip chip = new Chip();
                    chips.Add(chip);

                    chip.XPosition = x;
                    chip.YPosition = y;
                    layout[x, y]   = chip;

                    Vector2 chipTexCoordFactor = new Vector2(1.0f / Width, 1.0f / Height);

                    chip.TexCoordScale            = chipTexCoordFactor;
                    chip.TexCoordTranslationFront = new Vector2((x * chipTexCoordFactor.X), ((Height - 1) - y) * chipTexCoordFactor.Y);
                    chip.TexCoordTranslationBack  = new Vector2(((Width - 1) - x) * chipTexCoordFactor.X, ((Height - 1) - y) * chipTexCoordFactor.Y);
                }
            }

            emptyX = RandomHelper.Random.Next(0, Width);
            emptyY = RandomHelper.Random.Next(0, Height);
            Chip removed = layout[emptyX, emptyY];

            chips.Remove(removed);
            layout[emptyX, emptyY] = null;
        }
Beispiel #4
0
        public void Update(GameTime gameTime)
        {
            this.camera.Update(gameTime);
            this.lighting.Update(gameTime, camera);

            if (nextPictureSet != null)
            {
                textureRotationTime += (float)gameTime.ElapsedRealTime.TotalSeconds;
                if (textureRotationTime >= textureRotationDuration)
                {
                    if (currentPictureSet != null)
                    {
                        currentPictureSet.Unload();
                    }

                    currentPictureSet = nextPictureSet;
                    nextPictureSet    = null;

                    textureRotationTime = 0.0f;
                }
            }

            if (IsShifting)
            {
                currentShiftTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

                if (currentShiftTime > ShiftDuration)
                {
                    shiftingChips.Clear();
                    shiftX = 0;
                    shiftY = 0;
                }
            }

            foreach (Chip chip in chips)
            {
                chip.Update(gameTime);
            }
        }
Beispiel #5
0
		public Board( int sizeX, int sizeY, bool twoSided ) {
			this.twoSided = twoSided;
			this.width = sizeX;
			this.height = sizeY;

			camera = new Camera( (float)Math.Max( sizeX, sizeY ) * 400.0f / 5.0f );

			nextPictureSet = PictureDatabase.GetNextPictureSet( twoSided ? 2 : 1 );

			this.layout = new Chip[ Width, Height ];
			this.boardPositionMatrices = new Matrix[ Width, Height ];

			for( int y = 0; y < Height; y++ ) {
				for( int x = 0; x < Width; x++ ) {
					Chip chip = new Chip();
					chips.Add( chip );

					chip.XPosition = x;
					chip.YPosition = y;
					layout[ x, y ] = chip;

					Vector2 chipTexCoordFactor = new Vector2( 1.0f / Width, 1.0f / Height );

					chip.TexCoordScale = chipTexCoordFactor;
					chip.TexCoordTranslationFront = new Vector2( ( x * chipTexCoordFactor.X ), ( ( Height - 1 ) - y ) * chipTexCoordFactor.Y );
					chip.TexCoordTranslationBack = new Vector2( ( ( Width - 1 ) - x ) * chipTexCoordFactor.X, ( ( Height - 1 ) - y ) * chipTexCoordFactor.Y );
				}
			}

			emptyX = RandomHelper.Random.Next( 0, Width );
			emptyY = RandomHelper.Random.Next( 0, Height );
			Chip removed = layout[ emptyX, emptyY ];
			chips.Remove( removed );
			layout[ emptyX, emptyY ] = null;
		}
Beispiel #6
0
		public void Update( GameTime gameTime ) {
			this.camera.Update( gameTime );
			this.lighting.Update( gameTime, camera );

			if( nextPictureSet != null ) {
				textureRotationTime += (float)gameTime.ElapsedRealTime.TotalSeconds;
				if( textureRotationTime >= textureRotationDuration ) {
					if( currentPictureSet != null )
						currentPictureSet.Unload();

					currentPictureSet = nextPictureSet;
					nextPictureSet = null;

					textureRotationTime = 0.0f;
				}
			}

			if( IsShifting ) {
				currentShiftTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

				if( currentShiftTime > ShiftDuration ) {
					shiftingChips.Clear();
					shiftX = 0;
					shiftY = 0;
				}
			}

			foreach( Chip chip in chips )
				chip.Update( gameTime );
		}