public PathProcessor(int threadNum, PathReturnQueue returnQueue, NavSystem system) { if (threadNum < 0) { throw new ArgumentOutOfRangeException("processors illegal"); } active = system; if (threadNum > 0) { m_Threads = new Thread[threadNum]; m_Handlers = new PathHandler <T> [threadNum]; for (int i = 0; i < threadNum; i++) { } IsMultiThread = true; } else { m_Threads = new Thread[0]; m_Handlers = new PathHandler <T> [1]; m_Handlers[0] = new PathHandler <T>(0, 0); threadCourtine = CalculatePath(m_Handlers[0]); IsMultiThread = false; } m_ReturnQueue = returnQueue; m_ControlQueue = new ThreadControlQueue(threadNum); m_IndexPool = new Stack <int>(); m_MaxFrameTime = 0; }
public override double Solve() { var input = InputLines(); return(input.Aggregate(0.0, (acc, line) => { var result = NavSystem.Validate(line); return acc + result.ScoreCorrupt; })); }
// *************************************************************************** // Monobehaviours // *************************************************************************** private void Awake() { Instance = this; NavSystem = new NavSystem(TileGenerator.Instant.Tiles); startTile = null; endTile = null; path = new List <Location>(); timer = new Stopwatch(); }
// *************************************************************************** // Monobehaviours // *************************************************************************** private void Awake() { Instant = this; stopwatch = new Stopwatch(); NavSystem = new NavSystem(TileGenerator.Instant.Tiles); Tiles = TileGenerator.Instant.Tiles; TilesTotalText.text = Tiles.Count.ToString(); tilemap = new TileMap("CCTester Tilemap"); TileInputChanged("0"); }
// **************************************************************************************************** // INITIATION // **************************************************************************************************** void Start() { camera = GetComponent <Camera> (); pathMesh = Instantiate(theAStarPath) as GameObject; pathLocations = new List <Vector3> (); _NavSystem = NavSystem.S; _NavSystem.Initialize_NavSystem(); _mapX = _NavSystem.getMapWidthX(); _mapZ = _NavSystem.getMapLengthZ(); Invoke("delayedCommands", 0.5f); }
protected override void OnCreate() { navSystem = World.GetOrCreateSystem <NavSystem>(); navSystem.Settings = new NavSettings { DestinationRateLimitSeconds = 0.8f, DestinationSurfaceColliderRadius = 1, JumpSecondsMax = 5, ObstacleRaycastDistanceMax = 1000, SurfaceRaycastDistanceMax = 1000, StoppingDistance = 1, SurfaceLayer = 28, ObstacleLayer = 29, ColliderLayer = 30, IterationMax = 1000, NavMeshQueryNodeMax = 0, NeedsSurfaceMapSize = 1000, PathSearchMax = 1000, SurfaceRaycastMax = 100 }; }
public override void OnInspectorGUI() { NavSystem system = target as NavSystem; if (Configure == null) { Configure = AssetDatabase.LoadAssetAtPath <NavSystemConfigure>(GameManagerWindow.ConfigurePath + "NavSystemConfigure.asset"); } if (Configure == null) { Configure = ScriptableObject.CreateInstance <NavSystemConfigure>(); AssetDatabase.CreateAsset(Configure, "Assets/Resources/ScriptableObjects/NavSystemConfigure.asset"); } Configure.OnGUI(); if (GUILayout.Button("Bake")) { Bake(); } base.OnInspectorGUI(); }
// 00000000000000000000000000000 // **************************************************************************************************** // INITIATION // **************************************************************************************************** void Awake() { // initialize the singleton S = this; }
//TODO: I really hate this, I don't want to have to make a class based on an enum public void AddObjectEntity(ObjectData data) { switch (data.type) { case ObjectType.Chest: Chest temp = new Chest(ScriptableObject.Instantiate(mCurrentMap.Data.chestType)); temp.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.FallingRock: FallingRock temp2 = new FallingRock(Resources.Load("Prototypes/Entity/Objects/FallingRock") as EntityPrototype); temp2.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.FlowerBed: FlowerBed temp3 = new FlowerBed(Resources.Load("Prototypes/Entity/Objects/FlowerBed") as EntityPrototype); temp3.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.Tree: Tree temp4 = new Tree(Resources.Load("Prototypes/Entity/Objects/Tree") as EntityPrototype); temp4.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.Medbay: MedicalBay temp5 = new MedicalBay(Resources.Load("Prototypes/Entity/Objects/Medbay") as EntityPrototype); temp5.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.Door: if (mCurrentMap.mapType != MapType.BossMap) { Door temp6 = new Door(Resources.Load("Prototypes/Entity/Objects/Door") as DoorPrototype); if (mCurrentMap.Data.hasMiniboss) { temp6.locked = true; } temp6.Spawn(GetMapTilePosition(data.TilePosition)); } break; case ObjectType.NavSystem: NavSystem temp7 = new NavSystem(Resources.Load("Prototypes/Entity/Objects/NavSystem") as EntityPrototype); temp7.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.BouncePad: BouncePad temp8 = new BouncePad(Resources.Load("Prototypes/Entity/Objects/BouncePad") as EntityPrototype); temp8.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.Spikes: Spikes temp9 = new Spikes(Resources.Load("Prototypes/Entity/Objects/Spikes") as EntityPrototype); temp9.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.Iceblock: Iceblock temp10 = new Iceblock(Resources.Load("Prototypes/Entity/Objects/Iceblock") as EntityPrototype); temp10.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.AnalysisCom: AnalysisCom temp11 = new AnalysisCom(Resources.Load("Prototypes/Entity/Objects/AnalysisCom") as EntityPrototype); temp11.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.Item: if (data is ItemObjectData itemData) { ItemObject temp12 = new ItemObject(ItemDatabase.GetItem(itemData.itemType), Resources.Load("Prototypes/Entity/Objects/ItemObject") as EntityPrototype); temp12.Spawn(GetMapTilePosition(data.TilePosition)); } break; case ObjectType.SmallGatherable: Gatherable temp13 = new Gatherable(Resources.Load("Prototypes/Entity/Objects/Gatherables/Small Blue Vein") as GatherablePrototype); temp13.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.LargeGatherable: Gatherable temp14 = new Gatherable(Resources.Load("Prototypes/Entity/Objects/Gatherables/Large Blue Vein") as GatherablePrototype); temp14.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.SaveMachine: SaveMachine temp15 = new SaveMachine(Resources.Load("Prototypes/Entity/Objects/SaveMachine") as EntityPrototype); temp15.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.BreakableTile: BreakableTile temp16 = new BreakableTile(Resources.Load("Prototypes/Entity/Objects/BreakableTile") as EntityPrototype); temp16.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.PracticeBot: PracticeBot temp17 = new PracticeBot(Resources.Load("Prototypes/Entity/Objects/PracticeBot") as EntityPrototype); temp17.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.ShipTeleporter: ShipTeleporter temp18 = new ShipTeleporter(Resources.Load("Prototypes/Entity/Objects/ShipTeleporter") as EntityPrototype); temp18.Spawn(GetMapTilePosition(data.TilePosition)); break; case ObjectType.MovingPlatform: MovingPlatform temp19 = new MovingPlatform(Resources.Load("Prototypes/Entity/Objects/MovingPlatform") as EntityPrototype); temp19.Spawn(GetMapTilePosition(data.TilePosition)); break; } }