public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
        {
            AnimatedBodyPartGroup wheatBale     = new AnimatedBodyPartGroup(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.Wheat), 1.0f / 7.0f);
            AnimatedBodyPartGroup log           = new AnimatedBodyPartGroup(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.Wood), 1.0f / 7.0f);
            AnimatedBodyPartGroup standardBlock = new AnimatedBodyPartGroup(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.standardBlock), 1.0f / 7.0f);

            wheatBale.setScale(1f / 7f);
            log.setScale(1f / 7f);
            standardBlock.setScale(1f / 7f);

            foreach (BlockLoc key in resourceBlocks.Keys)
            {
                switch (resourceBlocks[key].getResourceType())
                {
                case ResourceBlock.ResourceType.Wood:
                    log.setRootPartLocation(key.getMiddleInWorldSpace());
                    log.draw(device, effect);
                    break;

                case ResourceBlock.ResourceType.Wheat:
                    wheatBale.setRootPartLocation(key.getMiddleInWorldSpace());
                    wheatBale.draw(device, effect);
                    break;

                case ResourceBlock.ResourceType.standardBlock:
                    standardBlock.setRootPartLocation(key.getMiddleInWorldSpace());
                    standardBlock.draw(device, effect);
                    break;
                }
            }
            foreach (Stockpile stockpile in stockpiles)
            {
                stockpile.draw(device, effect, parameters);
            }
        }
Exemple #2
0
        public void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
        {
            string path = @"worldMarkup\farmMarker.chr";

            path = ResourceBlock.getPathForResourceType(typeToStore);
            AnimatedBodyPartGroup character = new AnimatedBodyPartGroup(ContentDistributor.getEmptyString() + path, 1.0f / 7.0f);
            float opacity = .2f;

            if (!parameters.hasParameter(DisplayParameter.drawStockpiles))
            {
                opacity = .1f;
            }

            //forward rendering is faster here
            effect.Parameters["xOpacity"].SetValue(opacity);
            character.setScale(1f / 7f);
            foreach (BlockLoc test in storageSpace)
            {
                character.setRootPartLocation(test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f));
                character.draw(device, effect);
            }
            effect.Parameters["xOpacity"].SetValue(1);
        }