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); }
private void handleDragging(PlayerAction.Action action) { PlayerAction.Dragging dragClick = (PlayerAction.Dragging)action; Ray dragRay = dragClick.getRay(); Vector3?dragBlock = world.getBlockAlongRay(dragRay); if (dragBlock.HasValue) { BlockLoc currentDragBlock = new BlockLoc((int)((Vector3)dragBlock).X, (int)((Vector3)dragBlock).Y, (int)((Vector3)dragBlock).Z); IEnumerable <BlockLoc> draggedBlocks; if (dragClick.getDragType() == PlayerAction.Dragging.DragType.excavate) { draggedBlocks = world.GetBlocksBoundBy(player.getFirstBlockInDrag(), currentDragBlock); } else { draggedBlocks = world.getSurfaceBlocksBoundBy(player.getFirstBlockInDrag(), currentDragBlock); } float draggedBlockOpacity = .5f; foreach (BlockLoc test in draggedBlocks) { switch (dragClick.getDragType()) { case PlayerAction.Dragging.DragType.farm: WorldMarkupHandler.addFlagPathWithPosition(ContentDistributor.getEmptyString() + @"worldMarkup\farmMarker.chr", test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f)); break; case PlayerAction.Dragging.DragType.storeWheat: WorldMarkupHandler.addCharacter(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.Wheat), test.toWorldSpaceVector3() + new Vector3(.5f, 1.5f, .5f), 1f / 7f, draggedBlockOpacity); WorldMarkupHandler.addCharacter(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.Wheat), test.toWorldSpaceVector3() + new Vector3(.5f, 2.5f, .5f), 1f / 7f, draggedBlockOpacity); break; case PlayerAction.Dragging.DragType.storeWood: WorldMarkupHandler.addCharacter(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.Wood), test.toWorldSpaceVector3() + new Vector3(.5f, 1.5f, .5f), 1f / 7f, draggedBlockOpacity); WorldMarkupHandler.addCharacter(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.Wood), test.toWorldSpaceVector3() + new Vector3(.5f, 2.5f, .5f), 1f / 7f, draggedBlockOpacity); break; case PlayerAction.Dragging.DragType.storeStone: WorldMarkupHandler.addCharacter(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.standardBlock), test.toWorldSpaceVector3() + new Vector3(.5f, 1.5f, .5f), 1f / 7f, draggedBlockOpacity); WorldMarkupHandler.addCharacter(ResourceBlock.getPathForResourceType(ResourceBlock.ResourceType.standardBlock), test.toWorldSpaceVector3() + new Vector3(.5f, 2.5f, .5f), 1f / 7f, draggedBlockOpacity); break; case PlayerAction.Dragging.DragType.excavate: WorldMarkupHandler.addFlagPathWithPosition(ContentDistributor.getEmptyString() + @"worldMarkup\redCubeOutline.chr", test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f), 1.1f / 7f); break; default: throw new Exception("unhandled dragType " + dragClick.getDragType()); } } } }
protected override void LoadContent() { game = new Game(graphics.GraphicsDevice); ContentDistributor.loadContent(Content); SoundsManager.loadContent(Content); game.LoadContent(Content); spriteBatch = new SpriteBatch(GraphicsDevice); }
private static string getProperPath(string path) { path = path.ToUpper(); if (!path.Contains(@"C:\".ToUpper())) { path = ContentDistributor.getEmptyString() + path; } return(path); }