Esempio n. 1
0
        public void Bump()
        {
            if (this.SheetState == SpriteStates.Sheets.USED)
            {
                return;
            }
            if (!this.Bumping)
            {
                Console.WriteLine("Bumping the block.");
                this.Bumping = true;

                SoundFactory.PlaySoundEffect(SoundFactory.BlockBump());

                if (this.SheetState == SpriteStates.Sheets.HIDDEN)
                {
                    this.SetSheetState(SpriteStates.Sheets.QUESTION);
                }

                new Thread(new ThreadStart(delegate()
                {
                    Console.WriteLine("Starting bump, current spriteState: {0}", this.SpriteState);
                    int startY           = this.Info.y;
                    this.Info.velocity.Y = -1;
                    Thread.Sleep(100);
                    this.Info.velocity.Y = 1;
                    Thread.Sleep(100);
                    this.Info.velocity.Y = 0;
                    this.Info.velocity.X = 0;
                    this.Bumping         = false;
                    this.Info.position.Y = startY;
                })).Start();
            }
            else
            {
                Console.WriteLine("Bump is busy!");
            }
        }