Пример #1
0
 private int GetItemScore(FallingItem item)
 {
     switch (item.mType) {
         case FallingItemType.Coin500Yen:	return 500;
         case FallingItemType.Coin100Yen:	return 100;
         case FallingItemType.Coin50Yen:		return 50;
         case FallingItemType.Coin10Yen:		return 10;
         case FallingItemType.Coin5Yen:		return 5;
         case FallingItemType.Coin1Yen:		return 1;
         /*
         case FallingItemType.Cherry:		return -100;
         case FallingItemType.BigCherry:		return -500;
         case FallingItemType.Spike:			return -250;
         */
     }
     return 0;
 }
Пример #2
0
        private void DropNewItem(FallingItemType newItemType)
        {
            double dropWidth = Math.Min(this.mSceneRect.Right - this.mSceneRect.Left,
                this.mSceneRect.Bottom - this.mSceneRect.Top);

            double itemSize = 0.0;

            if (newItemType == FallingItemType.Cherry ||
                newItemType == FallingItemType.BigCherry ||
                newItemType == FallingItemType.Spike) {
                itemSize = this.GetItemImageSource(newItemType).PixelWidth / 2.5;
            } else {
                itemSize = this.GetItemImageSource(newItemType).PixelWidth / 8 / 2;
            }

            FallingItem fallingItem = new FallingItem() {
                mCenterPosition = new Point(this.mRandom.NextDouble() * dropWidth +
                    (this.mSceneRect.Left + this.mSceneRect.Right - dropWidth) / 2.0,
                    this.mSceneRect.Top - itemSize),
                mSize = itemSize,
                mVelocityX = 0.0,
                mVelocityY = (0.5 - this.mRandom.NextDouble() - 0.25) / this.mTargetFrameRate,
                mType = newItemType,
                mDissolve = 0.0,
                mState = FallingItemState.Falling,
                mImageSource = this.GetItemImageSource(newItemType)
            };

            this.mFallingItems.Add(fallingItem);
        }