Exemplo n.º 1
0
 public TileItem(Tile key, Rect value)
 {
     this.key = key;
     this.value = value;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Check if the hex's tile type is the provided tile
 /// </summary>
 /// <param name="hex">Hex to compare to the tile</param>
 /// <param name="tile">Tile to compare to the hex</param>
 /// <returns></returns>
 private static bool TestRule(Hex hex, Tile tile)
 {
     if (hex.terrainType == tile) { return true; } else { return false; }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Removes a tile from the tile array.
 /// </summary>
 /// <param name="t">Improvement to remove</param>
 /// <remarks>
 /// Removing a tile that is referenced elsewhere will cause null reference errors. Only use this
 /// method if you are personally managing the specific tiles memory lifetime.
 /// </remarks>
 public void DeleteTile(Tile t)
 {
     tiles.Remove(t);
     internalTiles = tiles.ToArray();
     UpdateTileNames();
 }
Exemplo n.º 4
0
        /// <summary>
        /// This is the setup called from HexChunk when it's ready for us to generate our meshes.
        /// </summary>
        /// <example>
        /// The following code will start hex operations on a new hex provided that the hexagon has a valid parent chunk and world manager.
        /// <code>
        /// class HexTest : MonoBehaviour
        /// {
        ///     HexInfo hex;
        ///     
        ///     void Start()
        ///     {
        ///         hex = new HexInfo();
        ///         
        ///         hex.Start();
        ///     }
        /// }
        /// </code>
        /// </example>
        public void Start()
        {
            //set tile type to the mountain tile if the feature is a mountain and the type exists
            if (terrainFeature == Feature.Mountain) { Tile mountain = parentChunk.worldManager.tileManager.TryGetMountain(); if (mountain != null) {  terrainType = mountain; } }

            //get the texture atlas from world manager
            worldTextureAtlas = parentChunk.worldManager.textureAtlas;

            parentChunk.worldManager.axialToHexDictionary.Add(AxialCoordinates, (Hex)this);

            //cache neighbors of this hexagon
            neighbors = parentChunk.worldManager.GetNeighborsOfHex((Hex)this);

            //generate local mesh
            MeshSetup();

            //if we are NOT loading a map
            if (parentChunk.worldManager.generateNewValues == true)
            {
                //check for resources and default to no improvement
                currentImprovement = improvementManager.improvements[0];
                resourceManager.CheckForResource((Hex)this);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Adds a tile to the tile array.
 /// </summary>
 /// <param name="t">Tile to add</param>
 /// <remarks>
 /// This method should only be used before world generation.
 /// </remarks>
 public void AddTile(Tile t)
 {
     tiles.Add(t);
     internalTiles = tiles.ToArray();
     UpdateTileNames();
 }