public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters) { foreach (BlockLoc test in blocksToBeRemoved) { WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString() + @"worldMarkup\redCubeOutline.chr", test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f), 1.1f / 7f, .6f); } }
public Boat(Vector3 nLoc) { nLoc += new Vector3(.5f, 0, .5f); setupAnimatedBodyPartGroup(ContentDistributor.getEmptyString() + @"boats\onePersonBoat.chr", SCALE); nLoc.Y = permanentYLocation; physics = new PhysicsHandler(new AxisAlignedBoundingBox(new Vector3(-1, 0, -1) + nLoc, new Vector3(1f, .1f, 1f) + nLoc)); faction = Faction.neutral; }
public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters) { foreach (BlockLoc test in plantBlocks.Keys) { string number = plantBlocks[test].getGrowthLevel() + ""; WorldMarkupHandler.addFlagPathWithPosition(ContentDistributor.getEmptyString() + @"worldMarkup\wheatGrowthStage" + number + ".chr", test.toWorldSpaceVector3() + new Vector3(.5f, -.5f, .5f)); } }
private static string getCode() { String path = ContentDistributor.getRealRootPath() + @"GENERATIONCODE\IslandGeneration.cs"; System.IO.StreamReader myFile = new System.IO.StreamReader(path); string source = myFile.ReadToEnd(); myFile.Close(); return(source); }
public DecorativePlant(BlockLoc FootLocation) { blockRootedIn = FootLocation; float height = 5; Random rand = new Random(); string[] possiblePlants = { "yellowFlower", "blueFlower", "shortLeafyPlant", "bush" }; string plantName = possiblePlants[rand.Next(possiblePlants.Length)]; setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3() + new Vector3(0, 1, 0), FootLocation.toWorldSpaceVector3() + new Vector3(0, 1, 0) + new Vector3(1f, height, 1f)), ContentDistributor.getEmptyString() + @"world_decoration\" + plantName + ".chr"); setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f))); }
public static string[] getCharFile(string path) { //path = path.ToUpper(); if (!loadedCharFiles.ContainsKey(path)) { string[] loaded = System.IO.File.ReadAllLines(ContentDistributor.addNecesaryPathing(path)); loadedCharFiles.Add(path, loaded); return(loaded); } else { return(loadedCharFiles[path]); } }
public void HandleBlockPlanPlacementMouseover(Ray ray) { Island island = islandManager.getClosestIslandToLocation(ray.Position); Vector3?maybeSpace = island.getLastSpaceAlongRayConsideringBuildSite(ray); if (maybeSpace.HasValue) { Vector3 space = (Vector3)maybeSpace; space.X = (int)space.X; space.Y = (int)space.Y; space.Z = (int)space.Z; WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString() + @"worldMarkup\" + "stoneMarkerOutline" + ".chr", ((Vector3)space) + new Vector3(.5f, .5f, .5f), 1.0f / 12.0f, .6f); } }
public static string getPathForResourceType(ResourceType type) { switch (type) { case ResourceType.standardBlock: return(ContentDistributor.getEmptyString() + @"resources\standardBlock.chr"); case ResourceType.Wheat: return(ContentDistributor.getEmptyString() + @"resources\wheatBale.chr"); case ResourceType.Wood: return(ContentDistributor.getEmptyString() + @"resources\log.chr"); default: throw new Exception("unhandled resource type"); } }
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 Character(AxisAlignedBoundingBox nAABB, Faction nFaction) { load = new CharacterLoad(); job = new UnemployedJob(); physics = new PhysicsHandler(nAABB); faction = nFaction; if (faction == Faction.friendly) { bodyType = BodyType.Minotuar; switchBodies(ContentDistributor.getEmptyString() + "minotuar.chr"); } else { bodyType = BodyType.Ghoul; switchBodies(ContentDistributor.getEmptyString() + @"ghoul\ghoul.chr"); walkSpeedWhilePathing *= .9f; } }
void setupBodyPartGroupGivenCurrentJob() { switch (bodyType) { case BodyType.Ghoul: switchBodies(ContentDistributor.getEmptyString() + @"ghoul\ghoul.chr"); break; case BodyType.Minotuar: switch (currentJobType) { case JobType.combat: switchBodies(ContentDistributor.getEmptyString() + "armedMinotuar.chr"); break; case JobType.agriculture: switchBodies(ContentDistributor.getEmptyString() + "farmMinotuar.chr"); break; case JobType.mining: switchBodies(ContentDistributor.getEmptyString() + "mineMinotuar.chr"); break; case JobType.building: switchBodies(ContentDistributor.getEmptyString() + "buildMinotuar.chr"); break; case JobType.logging: switchBodies(ContentDistributor.getEmptyString() + "axeMinotuar.chr"); break; case JobType.CarryingSomething: handleBodyPartChangeForCarryingItem(); break; default: //switchBodies(ContentDistributor.getEmptyString() + "minotuar.chr"); break; } break; } }
private void handleBodyPartChangeForCarryingItem() { if (load.isCaryingItem()) { switch (load.getLoad()) { case ResourceBlock.ResourceType.standardBlock: switchBodies(ContentDistributor.getEmptyString() + "carryingStandardBlockMinotuar.chr"); break; case ResourceBlock.ResourceType.Wheat: switchBodies(ContentDistributor.getEmptyString() + "carryingWheatMinotuar.chr"); break; case ResourceBlock.ResourceType.Wood: switchBodies(ContentDistributor.getEmptyString() + "carryingLogMinotuar.chr"); break; } } }
static PaintedCubeSpace loadSpaceFromDisk(string path) { byte[, ,] byteArray; string fullPath = ContentDistributor.addNecesaryPathing(path); Stream stream = File.Open(fullPath, FileMode.Open); BinaryFormatter formatter = new BinaryFormatter(); byteArray = (byte[, , ])formatter.Deserialize(stream); FileInfo fileInfo = new FileInfo(fullPath); long fileLength = fileInfo.Length; int spaceWidth = (int)Math.Pow(fileLength, 1.0 / 3.0); int spaceHeight = (int)Math.Pow(fileLength, 1.0 / 3.0); stream.Close(); //loadedByteArrays.Add(path, byteArray); PaintedCubeSpace paintedCubeSpace = new PaintedCubeSpace(1, 1, new Vector3()); paintedCubeSpace.spaceWidth = spaceWidth; paintedCubeSpace.spaceHeight = spaceHeight; paintedCubeSpace.array = byteArray; paintedCubeSpace.createModel(Main.graphics.GraphicsDevice); LoadedCubeSpaceData dataToSave = new LoadedCubeSpaceData(); dataToSave.array = byteArray; dataToSave.spaceHeight = spaceHeight; dataToSave.spaceWidth = spaceWidth; dataToSave.vertexBuffer = paintedCubeSpace.getVertexBuffer(); dataToSave.indexBuffer = paintedCubeSpace.getIndexBuffer(); loadedByteArrays.Add(path, dataToSave); paintedCubeSpace.setLoadedFrompath(path); return(paintedCubeSpace); }
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 void loadFromFile(string path) { string[] file = DataLoader.getCharFile(ContentDistributor.getRealRootPath() + path); main = new BodyPart(); main.loadFromFile(file, 0, new FileInfo(ContentDistributor.getRealRootPath() + path)); }
public Tree(BlockLoc nFootLocation, treeTypes type) { FootLocation = nFootLocation; Random rand = new Random(); float height = 5; switch (type) { case treeTypes.maple: height = 5; string[] possibleTrees = { "tree1", "tree2" }; string treeName = possibleTrees[rand.Next(possibleTrees.Length)];//"fallTree1"; setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)), ContentDistributor.getEmptyString() + @"trees\" + treeName + ".chr", .8f + (float)new Random().NextDouble() * .4f); setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f))); break; case treeTypes.poplar: height = 5; string[] poplarNames = { "tree", "tree2", "tree3" }; string poplarName = poplarNames[rand.Next(poplarNames.Length)]; //"fallTree1"; setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)), ContentDistributor.getEmptyString() + @"poplarTree\" + poplarName + ".chr", .2f); setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f))); break; case treeTypes.pine: height = 5; string[] pineNames = { "tree" }; string pineName = pineNames[rand.Next(pineNames.Length)]; //"fallTree1"; String path = ContentDistributor.getEmptyString() + @"pineTree\" + pineName + ".chr"; setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)), path, .4f + (float)rand.NextDouble() * .3f); setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f))); break; case treeTypes.redwood: height = 5; string[] redwoodNames = { "tree" }; string redwoodName = redwoodNames[rand.Next(redwoodNames.Length)]; //"fallTree1"; setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)), ContentDistributor.getEmptyString() + @"redwood\" + redwoodName + ".chr", .2f); setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f))); break; case treeTypes.snowyPine: height = 5; string[] snowPineTreeNames = { "snowyPineTree" }; string snowPineTreeName = snowPineTreeNames[rand.Next(snowPineTreeNames.Length)]; //"fallTree1"; String snowPinePath = ContentDistributor.getEmptyString() + @"pineTree\" + snowPineTreeName + ".chr"; setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)), snowPinePath, .2f + (float)rand.NextDouble() * .2f); setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f))); break; case treeTypes.snowyLargePine: height = 5; string[] snowLargePineTreeNames = { "snowyDiskBasedPineTree" }; string snowyLargePineTreeName = snowLargePineTreeNames[rand.Next(snowLargePineTreeNames.Length)]; //"fallTree1"; String snowyLargePinePath = ContentDistributor.getEmptyString() + @"pineTree\" + snowyLargePineTreeName + ".chr"; setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)), snowyLargePinePath, .5f + (float)rand.NextDouble() * .3f); setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f))); break; default: break; } }
public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters) { WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString() + @"boats\greenOnePersonBoat.chr", objectLoc.toWorldSpaceVector3() + new Vector3(.5f, 0, .5f), IslandGame.GameWorld.Boat.SCALE, .5f); }