private void handleStrikeEffectOnIsland(ActorStrikeBlockAction strikeBlock) { switch (strikeBlock.getJobType()) { case JobType.mining: destroyBlock(strikeBlock.getStrikeTarget()); break; } }
public void acceptWorkStrike(ActorStrikeAction actorStrikeAction) { if (actorStrikeAction.getStrikeType() == ActorStrikeAction.StrikeType.OnBlock) { ActorStrikeBlockAction strikeBlock = (ActorStrikeBlockAction)actorStrikeAction; handleStrikeEffectOnIsland(strikeBlock); jobSiteManager.acceptStrikeAt(strikeBlock.getStrikeTarget(), strikeBlock.getJobType()); } else //NEEDS DISTANCE LIMITTING { ActorStrikeAlongRayAction rayStrike = (ActorStrikeAlongRayAction)actorStrikeAction; Ray ray = new Ray(rayStrike.getStrikeOrigen(), rayStrike.getStrikeDirectionNormal()); JobSite intersectedSite = getJobSiteAlongRay(ray); Vector3?blockClicked = getNearestBlockAlongRayInAndFromWorldSpace(ray); //figuring out what to do if both a block and site are along the ray if (blockClicked != null && intersectedSite != null) { if (Math.Abs(Vector3.Distance((Vector3)blockClicked, rayStrike.getStrikeOrigen()) - (float)intersectedSite.intersects(ray)) < .01) { //block has been clicked handleRayStrikeOnIslandBlocks(rayStrike, ray); } else if (Vector3.Distance((Vector3)blockClicked, rayStrike.getStrikeOrigen()) < (float)intersectedSite.intersects(ray)) { //block has been clicked handleRayStrikeOnIslandBlocks(rayStrike, ray); } else { //siteHasBeenClicked ray = JobSiteWasHitWithJobRay(rayStrike, ray, intersectedSite); } } else if (blockClicked != null) { //block has been clicked handleRayStrikeOnIslandBlocks(rayStrike, ray); } else if (intersectedSite != null) { //site has been clicked ray = JobSiteWasHitWithJobRay(rayStrike, ray, intersectedSite); } } }