public static void StartPlacements() { var selectectedMap = GameObject.Find("Hub").GetComponent<Hub>().CenterMap; var checker = new MapChecker(selectectedMap.map); var tile = findAvailableTile(selectectedMap); var height = (map.Height / 2) * 3.2f; var width = (map.Width / 2) * 3.2f; GameObject.Find("Player").transform.position = new Vector3(tile.X * 3.2f, tile.Y * 3.2f, -1); }
void Start() { player_rigidbody = GetComponent <Rigidbody>(); player_state = GetComponent <PlayerState>(); throwManager = GetComponent <ThrowManager>(); mapChecker = GetComponentInChildren <MapChecker>(); followDust = GetComponentInChildren <ParticleSystem>(); if (SceneManager.GetActiveScene().name == "Game_SceneNew") { qick = GameObject.Find("Quick_slot_new").GetComponent <Quick_slot_new>(); } child = transform.GetChild(0); dialogue = GameObject.Find("Dialogue").GetComponent <Dialogue>(); lookAt = transform.forward; is_run = false; player_mate.color = new Color(1f, 1f, 1f, 1); StartCoroutine(soundss()); }
public void DrawHubStartAndEndPoints(TileStruct[][] map, TileMap westMap, TileMap eastMap, TileMap southMap, TileMap northMap) { var NorthPoint = map[map.Length - 1][northMap.StartPointX].Clone(); var SouthPoint = map[0][southMap.EndPointX].Clone(); var WestPoint = map[westMap.EndPointY][0].Clone(); var EastPoint = map[eastMap.StartPointY][map[0].Length - 1].Clone(); DrawCorridorHorizontal( map, (map[0].Length) - TilesBeside(map, map[0].Length, eastMap.StartPointY, direction.left, TileType.Rock), map[0].Length, eastMap.StartPointY, TileType.Rock, TileType.Dirt, TerrainType, TerrainType); //Draw Corridor connecting map and SouthMap DrawCorridorHVertical( map, 0, TilesBeside(map, southMap.EndPointX, 0, direction.up, TileType.Rock), southMap.EndPointX, TileType.Rock, TileType.Dirt, TerrainType, TerrainType); MapChecker checker = new MapChecker(map); EastToSouth = checker.IsPointReachable(SouthPoint, EastPoint, direction.up); //Draw Corridor connecting map and WestMap DrawCorridorHorizontal( map, 0, TilesBeside(map, 0, westMap.EndPointY, direction.right, TileType.Rock), westMap.EndPointY, TileType.Rock, TileType.Dirt, TerrainType, TerrainType); checker = new MapChecker(map); SouthToWest = checker.IsPointReachable(SouthPoint, WestPoint, direction.right); //Draw Corridor connecting map and NorthMap DrawCorridorHVertical( map, (map.Length) - TilesBeside(map, northMap.StartPointX, map.Length, direction.down, TileType.Rock), map.Length, northMap.StartPointX, TileType.Rock, TileType.Dirt, TerrainType, TerrainType); checker = new MapChecker(map); WestToNorth = checker.IsPointReachable(WestPoint, NorthPoint, direction.right); }
public TileStruct[][] createMap(ref int startX, ref int startY, ref int endX, ref int endY) { BlankMap(); RandomFillMap(); MakeCaverns(); TileStruct[][] convertedArray = GetAsTileStructArr(); PlaceBorders(TileType.Rock, convertedArray); TrimMap(convertedArray); TrimMap(convertedArray); TrimMap(convertedArray); DrawStartAndEndPoints(convertedArray, ref startX, ref startY, ref endX, ref endY); MapChecker checker = new MapChecker(convertedArray); if (checker.IsPointReachable( GetTileData(convertedArray, startX, startY), GetTileData(convertedArray, endX, endY), direction.right)) { BreadthFirst(convertedArray, convertedArray[startY][startX]); Sprinkle(convertedArray, 62, DecorType.Grass); Sprinkle(convertedArray, 68, DecorType.Rock); return checker.map; } else { return createMap(ref startX, ref startY, ref endX, ref endY); } }