public Region(List <Vector3Int> regionTileCoords) { tileCoords = regionTileCoords; regionSize = regionTileCoords.Count; connectedRegions = new List <Region>(); edgeTiles = new List <Vector3Int>(); tileWithPassage = new Dictionary <Vector3Int, Passageway>(); HexMapGenerator mapGenerator = GameObject.FindGameObjectWithTag(Tags.HexMapGenerator).GetComponent <HexMapGenerator>(); regionType = mapGenerator.GetTile(regionTileCoords[0]).terrainType; foreach (Vector3Int coord in tileCoords) { mapGenerator.GetTile(coord).region = this; TerrainTile[] surroundingTiles = mapGenerator.GetSurroundingTiles(coord); foreach (TerrainTile ttb in surroundingTiles) { if (ttb == null) // should we consider the map edge to be a tile edge? { continue; } if (ttb.terrainType != regionType) { edgeTiles.Add(coord); // if we don't break here we'll get an edge tile per face instead of per tile break; } } } }
void Start() { GameObject hexMapEditorGO = GameObject.Find("Hex Map Editor"); if (hexMapEditorGO != null) { _hexMapEditor = hexMapEditorGO.GetComponent <HexMapEditor>(); //_hexMapEditor.AddHandler(gameObject); } GameObject hexMapGeneratorGO = GameObject.Find("Hex Map Generator"); if (hexMapGeneratorGO != null) { _hexMapGenerator = hexMapGeneratorGO.GetComponent <HexMapGenerator>(); } GameObject prefabManagerGO = GameObject.Find("Prefab Manager"); if (prefabManagerGO != null) { _prefabManager = prefabManagerGO.GetComponent <PrefabManager>(); } //defaults RiverModeIgnore.Value = true; RoadModeIgnore.Value = true; WalledModeIgnore.Value = true; TexturesList.SelectItem(0); }
private void Start() { if (string.IsNullOrEmpty(seed)) { seed = DateTime.Now.Millisecond.ToString(); } random.Value = new System.Random(seed.GetHashCode()); List <HexComb> connectedCombList = new List <HexComb>(); HexMapGenerator mapGenerator = new HexMapGenerator() { CombPrefab = hexComb, Size = gameConfiguration.MapSize, Rand = random.Value, MinHolesSize = MinHolesSize, MaxHolesSize = MaxHolesSize, HolesPercentage = HolesPercentage, Parent = transform }; mapGenerator.CombPrefab.hexTile = hexTile; StartCoroutine(ManageTiles(mapGenerator)); }
void Start() { ourPlayer = players[1]; hexGrid = GetComponent <HexGrid> (); generator = GetComponent <HexMapGenerator> (); generator.Generate(players); }
private void Start() { _quit.onClick.AddListener(OnQuitClick); _rebuildMap.onClick.AddListener(OnRebuildMapClick); _map = GameInstances.Instance.Map; hexMapGenerator = new HexMapGenerator(_map, _hexMesh, _gridParent); hexMapGenerator.CreateMap(); }
public void Init() { _starsConfig = GameConfig.Get <StarsConfig>(); _universeConfig = GameConfig.Get <UniverseConfig>(); _hexMapGenerator = new HexMapGenerator(); _planetUpdateCommand = GameModel.Get <PlanetPropsUpdateCommand>(); GameModel.HandleGet <StarModel>(OnStarChange); }
//public GameObject PlayerUnitPrefab; // Use this for initialization void Start() { hexMapGenetator = GameObject.FindObjectOfType <HexMapGenerator>(); if (isLocalPlayer == false) { return; } CmdSpawnMyUnit(); }
//TODO: sprawdzić, czy da się wykonać kolorowanie i nadawanie koordynatów jednocześnie private IEnumerator ManageTiles(HexMapGenerator mapGenerator) { yield return(null); yield return(mapGenerator.GenerateMap()); hexTileList = mapGenerator.TileList; ColorTiles(); GenerateSystemElements(); var hexagonalCoordinateController = new HexagonalCoordinateController(hexTileList.First()); hexagonalCoordinateController.ApplyCoordinates(); yield return(new WaitForEndOfFrame()); onMapGeneratedEvent.Invoke(); }
private void PlaceHexInternal(bool generate_neighbours) { SetKartezjanPos(); settled = true; ChangeTypeInternal(HexMapGenerator.GenerateHexType(id).Value); RotateRight(HexMapGenerator.GenerateHexType(id).Key); if (HexTypes.types[type].type == "forest") { PlaceForest(); } if (HexTypes.types[type].type == "water") { PlaceWater(); } if (generate_neighbours) { CreateNeighboursInternal(); } }
private Vector3 GetBaseInput() //returns the basic values, if it's 0 than it's not active. { HexMapGenerator hex = new HexMapGenerator(); kkx = transform.position; // TODO: set border for camera to move // if(hex.mapWidth >= transform.position.x AND ) // { // Debug.Log("Position z:"+ transform.position.z ); // } // else{ // Debug.Log("Position zz:"+ transform.position.z ); // } Vector3 p_Velocity = new Vector3(); if (Input.GetKey(KeyCode.W)) { p_Velocity += new Vector3(0, 0, 1); } if (Input.GetKey(KeyCode.S)) { p_Velocity += new Vector3(0, 0, -1); } if (Input.GetKey(KeyCode.A)) { p_Velocity += new Vector3(-1, 0, 0); } if (Input.GetKey(KeyCode.D)) { p_Velocity += new Vector3(1, 0, 0); } return(p_Velocity); }
private int temperatureJitterChannel; //天启系统用的随机通道 private void Awake() { Instance = this; }