void makeCloud(Vector3 loc, Random rand) { AnimatedBodyPartGroup cloud = new AnimatedBodyPartGroup(cloudPaths[rand.Next(cloudPaths.Length)], 5 + (float)rand.NextDouble() * 6.0f); cloud.setRootPartLocation(loc); clouds.Add(cloud); }
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); } }
public static void addFlagForThisFrame(Vector3 loc, string Color) { AnimatedBodyPartGroup flag = new AnimatedBodyPartGroup(ContentDistributor.getEmptyString() + @"worldMarkup\short" + Color + "Flag.chr", 1f / 12f); flag.setRootPartLocation((Vector3)loc); addAnimatedBodyPartGroupForThisFrame(flag); }
public static void addCharacter(string path, Vector3 position, float scale, float opacity) { FileInfo fileInfo = new FileInfo(path); if (fileInfo.Extension.ToUpper().Equals(".CHR")) { AnimatedBodyPartGroup character = new AnimatedBodyPartGroup(path, scale); character.addToWorldMarkup(Matrix.CreateTranslation(position), Quaternion.Identity, opacity); } }
private static MatrixAndOpacity setBodyPartGroupToParams(AnimatedBodyPartGroup flag, MatrixAndOpacity posScaleOpacity) { Vector3 scale; Vector3 translation; Quaternion rotation; posScaleOpacity.matrix.Decompose(out scale, out rotation, out translation); flag.setScale(scale.X); flag.setRootPartLocation(translation); flag.setRootPartRotationOffset(rotation); return(posScaleOpacity); }
public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters) { AnimatedBodyPartGroup block = new AnimatedBodyPartGroup(ContentDistributor.getEmptyString() + @"worldMarkup\" + markerName + ".chr", 1.0f / 7.0f); block.setScale(1f / 12f); foreach (BlockLoc test in blocksToBuild.Keys) { //WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString()+@"worldMarkup\"+markerName+".chr", // test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f), 1.0f/12.0f,.6f); block.setRootPartLocation(test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f)); effect.Parameters["xOpacity"].SetValue(.7f); effect.Parameters["xTint"].SetValue(ColorPallete.getColorFromByte(blocksToBuild[test]).ToVector4() * 1.2f); block.draw(device, effect); effect.Parameters["xTint"].SetValue(Color.White.ToVector4()); effect.Parameters["xOpacity"].SetValue(1f); } }
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); }
public static void addCharacter(AnimatedBodyPartGroup group, Vector3 position, float scale, float opacity) { group.addToWorldMarkup(Matrix.CreateTranslation(position), Quaternion.Identity, opacity); }
public static void addAnimatedBodyPartGroupForThisFrame(AnimatedBodyPartGroup toAdd) { CharactersForThisFrame.Add(toAdd); }