public void LinePath() { var geoMap = new Dictionary <Hex, GeographicTile> { { new Hex(0, 0), new GeographicTile() { heightLevel = MapHeight.l0, walkable = false } }, { new Hex(1, -1), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(1, 0), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(0, 1), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } } }; RuntimeMap map = new RuntimeMap(geoMap, 100); var layout = new Layout(Orientation.pointy, new FixVector2(1, 1), new FixVector2(0, 0)); ActiveMap activeMap = new ActiveMap(map, layout); var simplifiedPath = PathFindingSystem.HexFunnelAlgorithm ( new List <Hex>() { new Hex(0, 1), new Hex(1, 0), new Hex(1, -1) }, true, activeMap ); Assert.AreEqual(2, simplifiedPath.Count); Assert.AreEqual(new Hex(1, 0), simplifiedPath[0]); Assert.AreEqual(new Hex(1, -1), simplifiedPath[1]); }
protected override void OnNewParent() { base.OnNewParent(); //Parent.Add(debugMsg); Add(MotionB); InitLevel(); PathFinder = new PathFindingSystem(Background, DefaultPassableIntensityThreshold); InitPixie(); InitBadPixels(); InitToys(); InitLevelSpecific(); Add(Subtitles); }
private void Awake() { Instance = this; pathFinding = GetComponent <PathFindingSystem>(); }
public void LineVerticalPath() { var geoMap = new Dictionary <Hex, GeographicTile> { { new Hex(0, 0), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(-1, 1), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(0, 1), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(-2, 2), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(-1, 2), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(-2, 3), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(-1, 3), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, { new Hex(-2, 4), new GeographicTile() { heightLevel = MapHeight.l0, walkable = true } }, }; RuntimeMap map = new RuntimeMap(geoMap, 100); var layout = new Layout(Orientation.pointy, new FixVector2(1, 1), new FixVector2(0, 0)); ActiveMap activeMap = new ActiveMap(map, layout); var simplifiedPath = PathFindingSystem.HexFunnelAlgorithm ( new List <Hex>() { new Hex(0, 0), new Hex(-1, 1), new Hex(-1, 2), new Hex(-2, 3), new Hex(-2, 4), }, false, activeMap ); foreach (var item in simplifiedPath) { Debug.Log(item); } Assert.AreEqual(2, simplifiedPath.Count); var simplifiedPath2 = PathFindingSystem.HexFunnelAlgorithm ( new List <Hex>() { new Hex(0, 0), new Hex(-1, 1), new Hex(-2, 2), new Hex(-2, 3), new Hex(-2, 4), }, false, activeMap ); foreach (var item in simplifiedPath2) { Debug.Log(item); } Assert.AreEqual(2, simplifiedPath2.Count); }
protected override void OnCreate() { inputSystem = World.GetOrCreateSystem <InputSystem>(); selectionSystem = World.GetOrCreateSystem <SelectionSystem>(); lockstepSystemGroup = World.GetOrCreateSystem <LockstepSystemGroup>(); lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <CommandExecutionSystem>()); lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <VolatileCommandSystem>()); lockstepSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem <CommandableSafetySystem>()); blockMovementSystem = World.GetOrCreateSystem <BlockMovementSystem>(); onGroupCheckSystem = World.GetOrCreateSystem <OnGroupCheckSystem>(); updateReachableHexListSystem = World.GetOrCreateSystem <UpdateReachableHexListSystem>(); resourceSourceManagerSystem = World.GetOrCreateSystem <ResourceSourceManagerSystem>(); triggerGatherSystem = World.GetOrCreateSystem <TriggerGatherSystem>(); dropPointSystem = World.GetOrCreateSystem <DropPointSystem>(); triggerUpdateResBufferSystem = World.GetOrCreateSystem <TriggerUpdateResBufferSystem>(); updateResourceBufferSystem = World.GetOrCreateSystem <UpdateResourceBufferSystem>(); updateOcupationMapSystem = World.GetOrCreateSystem <UpdateOcupationMapSystem>(); updateDestinationSystem = World.GetOrCreateSystem <UpdateDestinationSystem>(); sightSystem = World.GetOrCreateSystem <SightSystem>(); pathRefreshSystem = World.GetOrCreateSystem <PathRefreshSystem>(); pathFindingSystem = World.GetOrCreateSystem <PathFindingSystem>(); pathChangeIndexSystem = World.GetOrCreateSystem <PathChangeIndexSystem>(); findPosibleTargetsSystem = World.GetOrCreateSystem <FindPosibleTargetsSystem>(); findActionTargetSystem = World.GetOrCreateSystem <FindActionTargetSystem>(); findMovementTargetSystem = World.GetOrCreateSystem <FindMovementTargetSystem>(); steeringSystem = World.GetOrCreateSystem <SteeringSystem>(); translationSystem = World.GetOrCreateSystem <TranslationSystem>(); movementFinisherSystem = World.GetOrCreateSystem <MovementFinisherSystem>(); collisionSystem = World.GetOrCreateSystem <CollisionSystem>(); directionSystem = World.GetOrCreateSystem <DirectionSystem>(); startActSystem = World.GetOrCreateSystem <StartActSystem>(); removeReceivingActComponentsSystem = World.GetOrCreateSystem <RemoveReceivingActComponentsSystem>(); initReceivingActComponentsSystem = World.GetOrCreateSystem <InitReceivingActComponentsSystem>(); attackSystem = World.GetOrCreateSystem <AttackSystem>(); receiveDamageSystem = World.GetOrCreateSystem <ReceiveDamageSystem>(); gatherSystem = World.GetOrCreateSystem <GatherSystem>(); extractResourceSystem = World.GetOrCreateSystem <ExtractResourceSystem>(); updateGathererAmmountSystem = World.GetOrCreateSystem <UpdateGathererAmmountSystem>(); endActionSystem = World.GetOrCreateSystem <EndActionSystem>(); resourceSystem = World.GetOrCreateSystem <ResourceSystem>(); deathSystem = World.GetOrCreateSystem <DeathSystem>(); //simulationSystemGroup = World.GetOrCreateSystem<SimulationSystemGroup>(); //simulationSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem<PathFindingSystem>()); //simulationSystemGroup.AddSystemToUpdateList(World.GetOrCreateSystem<PathFollowSystem>()); //lateSimulationSystemGroup = World.GetOrCreateSystem<LateSimulationSystemGroup>(); //applicationSystemGroup = World.GetOrCreateSystem<ApplicationSystemGroup>(); }