Пример #1
0
        private void handleAddVelocityAction(Vector3 velocityAddition, Actor actor, bool isFootPropelled)
        {
            Island closestIsland = islandManager.getClosestIslandToLocation(actor.getLocation());

            if (closestIsland == null)// if no islands are loaded
            {
                actor.setVelocity(new Vector3());
            }
            else
            {
                List <BlockLoc>      intersectedByActor = actor.getBlocksIntersectedByAABB();
                IslandPathingProfile profile            = closestIsland.getPathingProfile();
                if (!profile.isActorStanding(actor) && actor.canBeKnockedBack() && isFootPropelled && !Ocean.pointIsUnderWater(actor.getFootLocation()))
                {
                    actor.addToVelocity(velocityAddition * .02f);//character propells slowly in midair
                    return;
                }
                foreach (BlockLoc test in intersectedByActor)
                {
                    if (profile.isProfileSolidAtWithWithinCheck(test))
                    {
                        actor.setFootLocation(actor.getFootLocation() + new Vector3(0, .3f, 0));
                        return;
                    }
                }
                actor.addToVelocity(velocityAddition);
            }
        }
Пример #2
0
        internal void HandleBoatJobsitePlacement(Ray ray)
        {
            Vector3?oceanBlockIntesectionAtY1 = islandManager.getOceanIntersectionAtY1(ray);

            if (oceanBlockIntesectionAtY1.HasValue && islandManager.vehiclePlacedHereCouldBeBoarded(new BlockLoc((Vector3)oceanBlockIntesectionAtY1)))
            {
                BlockLoc boatSiteLoc = new BlockLoc((Vector3)oceanBlockIntesectionAtY1);
                Island   island      = islandManager.getClosestIslandToLocation((Vector3)oceanBlockIntesectionAtY1);
                island.addJobSite(new IslandGame.GameWorld.CharactersAndAI.BoatBuildSite(boatSiteLoc, island.getPathingProfile()));
            }
        }