예제 #1
0
        private void AddLichtungStuffPile(Vector2 location, WeightedInt[] itemIds)
        {
            int x        = (int)location.X;
            int y        = (int)location.Y;
            int numStuff = this.random.GetRandomValue(32, 128);

            for (int i = 0; i < numStuff; i++)
            {
                Location        offset          = GetTreasurePileOffset();
                OffsetVariation offsetVariation = GetTreasurePileOffsetVariation(offset);
                int             debrisX         = (x + offset.X) * 64 + this.random.GetRandomValue(offsetVariation.minX, offsetVariation.maxX);
                int             debrisY         = (x + offset.Y) * 64 + this.random.GetRandomValue(offsetVariation.minY, offsetVariation.maxY);

                Vector2 debrisLocation = new Vector2(debrisX, debrisY);

                Debris debris = new Debris(this.random.GetRandomValue(itemIds), debrisLocation, debrisLocation)
                {
                    chunkFinalYLevel  = debrisY,
                    chunkFinalYTarget = debrisY,
                    movingFinalYLevel = false
                };

                for (int j = 0; j < 100; j++)
                {
                    debris.timeSinceDoneBouncing += 100;
                    debris.updateChunks(Game1.currentGameTime, deepWoods);
                }

                foreach (Chunk chunk in debris.Chunks)
                {
                    chunk.xVelocity.Value  = 0;
                    chunk.yVelocity.Value  = 0;
                    chunk.rotationVelocity = 0;
                    chunk.position.X       = debrisX;
                    chunk.position.Y       = debrisY;
                    chunk.hasPassedRestingLineOnce.Value = true;
                    chunk.bounces = 3;
                }

                deepWoods.debris.Add(debris);
            }
        }