示例#1
0
        public void HandleExcavationMouseover(Ray hoverRay)
        {
            Vector3?space = getLastSpaceAlongRay(hoverRay);
            Vector3?block = getBlockAlongRay(hoverRay);

            if (space.HasValue && block.HasValue)
            {
                IntVector3 spaceLoc = new IntVector3((Vector3)space);
                IntVector3 blockLoc = new IntVector3((Vector3)block);

                Vector3 pointingTowardBlock = blockLoc.toVector3() - spaceLoc.toVector3();

                CubeAnimator.AnimatedBodyPartGroup flag = new CubeAnimator.AnimatedBodyPartGroup(@"worldMarkup\shovel.chr", 1f / 26f);
                flag.setRootPartLocation(spaceLoc.toVector3() + new Vector3(.5f, .5f, .5f));
                flag.setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(GeometryFunctions.getRotationMatrixFromNormal(pointingTowardBlock)));
                Compositer.addAnimatedBodyPartGroupForThisFrame(flag);
            }
        }
示例#2
0
 public IntVector3 profileSpaceToWorldSpace(IntVector3 blockToFlag)
 {
     return(new IntVector3(island.chunkSpaceToWorldSpace(blockToFlag.toVector3())));
 }
示例#3
0
        private void giveCharacterTravelJob(Character character, Ray rightClickRay)
        {
            Vector3?clicked = getIslandManager().getClosestIslandToLocation(character.getLocation()).getLastSpaceAlongRayConsideringResourceBlocks(rightClickRay);

            if (clicked.HasValue)
            {
                IntVector3           clickedBlock = new IntVector3((Vector3)clicked);
                IslandPathingProfile profile      = getIslandManager().getClosestIslandToLocation(character.getLocation()).getPathingProfile();

                PathHandler pathHandler = new PathHandler();

                Path path = pathHandler.getPathToSingleBlock(profile,
                                                             new BlockLoc(character.getFootLocation()), profile, new BlockLoc(clickedBlock.toVector3()), 2);

                TravelAlongPath walkTask = new TravelAlongPath(path);
                if (walkTask.isUseable())
                {
                    character.setJobAndCheckUseability(walkTask);
                }
                return;
            }

            Vector3?oceanClick = islandManager.getOceanIntersectionAtY1(rightClickRay);

            if (oceanClick.HasValue)
            {
                //List<BlockLoc> path = islandManager.getOceanPath((Vector3)oceanClick, character.getLocation());
                PathHandler pathHandler = new PathHandler();
                BlockLoc    goal        = new BlockLoc((Vector3)oceanClick);
                goal.setValuesInWorldSpace(goal.WSX(), 0, goal.WSZ());
                BlockLoc start = new BlockLoc(character.getLocation());
                start.setValuesInWorldSpace(start.WSX(), 0, start.WSZ());
                Path path = pathHandler.getPathToSingleBlock(getPathingProfile(),
                                                             start, getPathingProfile(), goal, 2);

                character.pathAlongOceanWithOceanPath(path);
            }
        }