コード例 #1
0
    public override void Initialize(World world, WorldCell cell)
    {
        base.Initialize(world, cell);

        IsAlive = true;
        SetEnergy(MaxEnergyValue);

        RandomGenerator = CurrentWorld.RandomGenerator;

        Direction         = Vector2Int.zero;
        NormalMoveSeconds = (float)MathFunctions.RandomDouble(RandomGenerator, MinAndMaxMoveSeconds);
        FastMoveDivisor   = (float)MathFunctions.RandomDouble(RandomGenerator, MinAndMaxFastMoveDivisor);
        FastMoveSeconds   = NormalMoveSeconds / FastMoveDivisor;
        MovementProgress  = 0;

        IsFemale = RandomGenerator.NextDouble() >= 0.5f;
        FemenineSprite.enabled  = IsFemale;
        MasculineSprite.enabled = !IsFemale;

        Render.transform.localScale = ChildScale.Div(transform.parent.lossyScale);
        transform.position          = CurrentPositionToReal();

        SecondsToGrow        = (float)MathFunctions.RandomDouble(RandomGenerator, MinAndMaxSecondsToGrow);
        ReproductionCooldown = (float)MathFunctions.RandomDouble(RandomGenerator, MinAndMaxReproductionCooldown);

        SecondsToOld = (float)MathFunctions.RandomDouble(RandomGenerator, MinAndMaxSecondsToOld);

        ActionsList = CreateActionsList();

        UpdateStateRenderer();
    }
コード例 #2
0
        public static IWorldCellState Create(WorldCell worldCell, bool alive)
        {
            if(alive)
                return new AliveState(worldCell);

            return new DeadState(worldCell);
        }
コード例 #3
0
ファイル: World.cs プロジェクト: CJRutter/LudumDare45
    private void CreateForeground()
    {
        //SetCell(10, 10, RockCellIndex, CellLayer.Foreground);
        //SetCell(2, 1, TranslucentCellIndex, CellLayer.Background);
        //FloodFillCells(0, 0, RockCellIndex, CellLayer.Foreground);

        var stateGen = new GridStateGen(Width, Height);

        stateGen.Randomise(0.5f, 1);
        stateGen.UpdateCells();

        for (int i = 0; i < 10; ++i)
        {
            stateGen.StepCaveGen();
            stateGen.UpdateCells();
        }

        for (int y = 0; y < Height; ++y)
        {
            for (int x = 0; x < Width; ++x)
            {
                WorldCell cell = GetCell(x, y, CellLayer.Foreground);

                int state = stateGen.Cells[x, y];
                if (state == 1)
                {
                    SetCell(x, y, RockCellIndex, CellLayer.Foreground);
                }
            }
        }
    }
コード例 #4
0
 public void AddCell(WorldCell cell)
 {
     if(!cells.Contains(cell))
     {
         cells.Add (cell);
     }
 }
コード例 #5
0
    public void SetCellToDescribe(WorldCell cell)
    {
        // Disable select of last object if that exists
        if (WorldObjSelected != null)
        {
            WorldObjSelected.SetSelected(false);
        }

        if (cell != null && cell.Content != null)
        {
            WorldObjSelected = cell.Content;
            WorldObjSelected.SetSelected(true);

            EntitySelected   = WorldObjSelected as Entity;
            FoodSelected     = WorldObjSelected as Food;
            IsEntitySelected = EntitySelected != null;

            if (IsWorldObjSelected())
            {
                InitializeWorldObjInfo();
            }
        }
        else
        {
            WorldObjPanel.gameObject.SetActive(false);
            FoodSelected   = null;
            EntitySelected = null;
        }
    }
コード例 #6
0
ファイル: Game1.cs プロジェクト: snowinmars/MarsIceEngine
        public Game1()
        {
            graphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                IsFullScreen       = true,
                HardwareModeSwitch = false
            };

            IsMouseVisible           = false;
            Window.AllowUserResizing = false;

            keyboardInputHelper = new KeyboardInputHelper();
            mouseInputHelper    = new MouseInputHelper();
            inputHelper         = new InputHelper(keyboardInputHelper, mouseInputHelper);

            Content.RootDirectory = "Content";
            Camera = new Camera();

            player = new Player();

            var cells = new WorldCell[Constants.WorldWidth, Constants.WorldHeight];

            for (var x = 0; x < Constants.WorldWidth; x++)
            {
                for (var y = 0; y < Constants.WorldHeight; y++)
                {
                    var cellCenterPosition = new Position(Constants.WorldCellWidth * x, Constants.WorldCellHeight * y);
                    var cell = new WorldCell(cellCenterPosition);
                    cells[x, y] = cell;
                }
            }

            world = new World(cells);
        }
コード例 #7
0
    public void init(WorldCell cell)
    {
        type = WorldObjectTypes.TerrainCell;
        attachObject (cell);

        componentManager.init (this);
    }
コード例 #8
0
ファイル: Creature.cs プロジェクト: hipolipolopigus/SkyNet
 public void Update(WorldCell Cell)
 {
     if(lastCell != Cell.id)
         Console.WriteLine("Creature {0} changed cell!", id);
     lastCell = Cell.id;
     x += Core.gen.Next(-10, 10) / 10.0;
     y += Core.gen.Next(-10, 10) / 10.0;
 }
コード例 #9
0
    public virtual void Initialize(World world, WorldCell cell, float normalMoveSeconds, float fastMoveDivisor)
    {
        Initialize(world, cell);

        NormalMoveSeconds = normalMoveSeconds;
        FastMoveDivisor   = fastMoveDivisor;
        FastMoveSeconds   = NormalMoveSeconds / FastMoveDivisor;
    }
コード例 #10
0
ファイル: WorldCell.cs プロジェクト: chasester/Random_Map
 public bool isequal(WorldCell wc)
 {
     if (wc.Tempature >= Tempature.x && wc.Tempature < Tempature.y && wc.Moisture >= Rain.x && wc.Moisture < Rain.y)
     {
         return(true);
     }
     return(false);
 }
コード例 #11
0
ファイル: WorldRenderer.cs プロジェクト: dav793/2D-RTS
 public void renderCell(WorldCell cell)
 {
     if (!cell.isRendered ()) {
         //Debug.Log("Rendering cell ("+cell.X+", "+cell.Y+")");
         cell.render (CellPool.pop ());
         updateRenderedCell (cell);
     }
 }
コード例 #12
0
ファイル: WorldRenderer.cs プロジェクト: dav793/2D-RTS
 public void unrenderCell(WorldCell cell)
 {
     if (cell.isRendered ()) {
         //Debug.Log("Unrendering cell ("+cell.X+", "+cell.Y+")");
         CellPool.push (cell.getRenderedGameObject ());
         cell.unrender ();
     }
 }
コード例 #13
0
ファイル: Renderer2D.cs プロジェクト: dav793/2D-SurvivalRPG
 public override void renderCell(WorldCell cell)
 {
     //Debug.Log ("Rendering "+cell.indexToString());
     RendererWorldObject rendererObj = worldObjectPool.pop ().GetComponent<RendererWorldObject> ();
     cell.attachRenderObject (rendererObj);
     rendererObj.init (cell);
     rendererObj.initSprites ();
     rendererObj.updatePosition ();
 }
コード例 #14
0
ファイル: WorldCell.cs プロジェクト: jonike/LoopDungeonCode
    public bool CanBeConnect(WorldCell other, int direction)
    {
        int otherValue = other.ConnectivityValue;

        int value = (otherValue & MASK[0]) >> 6 | (otherValue & MASK[1]) << 6;

        bool block = (value & MASK_DIRECTION[direction]) == 0 && (ConnectivityValue & MASK_DIRECTION[direction]) == 0;

        return(block || (value & ConnectivityValue & MASK_DIRECTION[direction]) != 0);
    }
コード例 #15
0
 private void AssignCoordinates()
 {
     for (int h = 0; h < Height; h++)
     {
         for (int w = 0; w < Width; w++)
         {
             Grid[h, w] = new WorldCell();
             Grid[h, w].Coordinates.x = h;
             Grid[h, w].Coordinates.y = w;
         }
     }
 }
コード例 #16
0
 /// <summary>
 /// Define a size of world. Must be used before any
 /// actions over sprites, scaling etc.
 /// Use only in gameobject initialization!
 /// </summary>
 /// <param name="x"> world's width </param>
 /// <param name="y"> world's height </param>
 private void SetWorldSize(int x, int y)
 {
     _worldMap = new WorldCell[y][];
     for (int i = 0; i < y; i++)
     {
         _worldMap[i] = new WorldCell[x];
         for (int j = 0; j < x; j++)
         {
             _worldMap[i][j] = new WorldCell(j, i);
         }
     }
     _worldWidth  = x;
     _wordlHeight = y;
 }
コード例 #17
0
ファイル: World.cs プロジェクト: CJRutter/LudumDare45
    public void BoxFillCells(int x, int y, int cellIndex, CellLayer layer, int startX, int startY, int endX, int endY)
    {
        WorldCell cell = null;

        if (cellIndex >= 0 && cellIndex < BaseWorldCells.Count)
        {
            cell = BaseWorldCells[cellIndex];
        }

        var     tilePos = new Vector3Int(x, y, 1);
        Tilemap tilemap = GetTilemap(layer);

        tilemap.BoxFill(tilePos, cell, startX, startY, endX, endY);
    }
コード例 #18
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public World()
 {
     Width  = WorldHeight;
     Height = WorldHeight;
     Map    = new WorldCell[Width, Height];
     for (var i = 0; i < Width; i++)
     {
         for (var j = 0; j < Height; j++)
         {
             // todo проверить оси
             Map[i, j] = new WorldCell(i, j);
         }
     }
 }
コード例 #19
0
ファイル: World.cs プロジェクト: CJRutter/LudumDare45
    public void SetCellColour(int x, int y, int cellIndex, CellLayer layer, Color colour)
    {
        WorldCell cell = null;

        if (cellIndex >= 0 && cellIndex < BaseWorldCells.Count)
        {
            cell = BaseWorldCells[cellIndex];
        }

        var     tilePos = new Vector3Int(x, y, 1);
        Tilemap tilemap = GetTilemap(layer);

        tilemap.SetColor(tilePos, colour);
    }
コード例 #20
0
ファイル: World.cs プロジェクト: CJRutter/LudumDare45
    public void FloodFillCells(int x, int y, int cellIndex, CellLayer layer)
    {
        WorldCell cell = null;

        if (cellIndex >= 0 && cellIndex < BaseWorldCells.Count)
        {
            cell = BaseWorldCells[cellIndex];
        }

        var     tilePos = new Vector3Int(x, y, 1);
        Tilemap tilemap = GetTilemap(layer);

        tilemap.FloodFill(tilePos, cell);
    }
コード例 #21
0
    public void SelectCell(bool isCollision, RaycastHit hit)
    {
        WorldCell cell = null;

        if (isCollision)
        {
            WorldObject worldObj = hit.transform.parent.GetComponent <WorldObject>();
            if (worldObj != null)
            {
                cell = worldObj.CurrentCell;
            }
            else
            {
                cell = CurrentWorld.GetClosestCell(hit.point);
            }
        }

        UI.SetCellToDescribe(cell);
    }
コード例 #22
0
    static bool CheckBorder11Conditions(WorldCell cell, string biome, string group, out int y_index)
    {
        /*
         *   	  | o |
         *     ___|___|___
         *        | b | o
         *     ___|___|___
         *        |   |
         *        |   |
         */

        if(
            cell.getNeighborCell(NeighborDirections.E) != null &&
            cell.getNeighborCell(NeighborDirections.N) != null &&
            cell.getNeighborCell(NeighborDirections.E).getRenderData().containsBiomeGroupBase(biome, group, out y_index) &&
            cell.getNeighborCell(NeighborDirections.N).getRenderData().containsBiomeGroupBase(biome, group, out y_index)
        )
            return true;
        return false;
    }
コード例 #23
0
ファイル: WorldRenderer.cs プロジェクト: dav793/2D-RTS
    public void updateRenderedCell(WorldCell cell)
    {
        if (cell.isRendered ()) {
            //Debug.Log("Updating cell: ("+cell.X+","+cell.Y+")");
            placeCellGameObject (cell);

            if (debugUIModeIsActive()) {
                cell.updateUI ();
            }
        }
    }
コード例 #24
0
    void initCells()
    {
        // declare cells
        cells = new WorldCell[
            GameSettings.LoadedConfig.SectorLength_Cells,
            GameSettings.LoadedConfig.SectorLength_Cells
        ];

        // init cells
        for (int cell_x = 0; cell_x < GameSettings.LoadedConfig.SectorLength_Cells; ++cell_x) {
            for (int cell_z = 0; cell_z < GameSettings.LoadedConfig.SectorLength_Cells; ++cell_z) {
                cells[cell_x, cell_z] = new WorldCell(
                    x * GameSettings.LoadedConfig.SectorLength_Cells + cell_x,
                    y,
                    z * GameSettings.LoadedConfig.SectorLength_Cells + cell_z,
                    this
                );
            }
        }
    }
コード例 #25
0
ファイル: World.cs プロジェクト: dav793/2D-SurvivalRPG
 public static WorldSectorLevel GetSectorLevelFromCell(WorldCell cell)
 {
     return GetSectorLevelFromCellIndex (cell.x, cell.y, cell.z);
 }
コード例 #26
0
    static void GenerateBiomeGroupBorders(WorldCell cell, string biome, string group)
    {
        if (!cell.getRenderData ().containsBiomeGroupBase (biome, group)) {
            // biome-group is not a base in this cell
            // check if any neighbor cells have biome-group base
            int y_index;

            if(CheckBorder0Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"t_border_0", y_index);
            if(CheckBorder1Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_1", y_index);
            if(CheckBorder2Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_2", y_index);
            if(CheckBorder3Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_3", y_index);
            if (CheckBorder4Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_4", y_index);
            if(CheckBorder5Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_5", y_index);
            if(CheckBorder6Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_6", y_index);
            if(CheckBorder7Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_7", y_index);
            if(CheckBorder8Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_8", y_index);
            if(CheckBorder9Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_9", y_index);
            if(CheckBorder10Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_10", y_index);
            if(CheckBorder11Conditions(cell, biome, group, out y_index))
                cell.getRenderData().addSprite(biome+"_"+group+"_border_11", y_index);
        }
    }
コード例 #27
0
    static void GenerateTerrainCellBase(WorldCell cell)
    {
        int terrain_type = UnityEngine.Random.Range(0, 2);
        string sprite_index = "";
        int sprite_y = 0;

        switch(terrain_type) {
        case 0:
            sprite_index = "dirt_light_base_0";
            sprite_y = 0;
            break;
        case 1:
            sprite_index = "grass_short_base_0";
            sprite_y = 1;
            break;
        }

        cell.getRenderData ().removeBorderSprites ();
        cell.getRenderData().addSprite(sprite_index, sprite_y);
    }
コード例 #28
0
 static void GenerateTerrainCellBorders(WorldCell cell)
 {
     // grass_short
     GenerateBiomeGroupBorders (cell, "grass", "short");
 }
コード例 #29
0
 protected override void CellChange(WorldCell newCell)
 {
     PreviousCell   = CurrentCell;
     Direction      = newCell.TerrainPos - WorldPosition2D;
     OriginPosition = CurrentPositionToReal();
 }
コード例 #30
0
 public virtual void unrenderCell(WorldCell cell)
 {
 }
コード例 #31
0
ファイル: WorldCell.cs プロジェクト: dav793/2D-RTS
 // Class instantiator (replaces the class constructor)
 public static WorldCell GetNew(int index_x, int index_y)
 {
     WorldCell temp = new WorldCell ();				// instantiate
     temp.Init (index_x, index_y);					// initialize
     return temp;
 }
コード例 #32
0
ファイル: WorldRenderer.cs プロジェクト: dav793/2D-RTS
 void placeCellGameObject(WorldCell cell)
 {
     GameObject cellRObj = cell.getRenderedGameObject ();
     cellRObj.transform.position = new Vector3 (
         cell.X * GameData_Config.CONFIG.CELL_LENGTH,
         cell.Y * GameData_Config.CONFIG.CELL_LENGTH,
         cellRObj.transform.position.z
     );
 }
コード例 #33
0
    // TODO make this work wtih all the different tilemap layers.
    private void PopulateSurroundingCells()
    {
        // If we gotta populate surrounding, make sure containing is up to date.
        if (containingCellCoordinates == null ||
            containingCellCoordinates.Count == 0)
        {
            PopulateContainingCells();
        }

        foreach (Vector2Int cellCoordinates in containingCellCoordinates)
        {
            WorldCell cell = WorldGridHolder.GetCell(cellCoordinates);
            if (cell != null)
            {
                if (cell.NorthernNeighbor != null)
                {
                    CheckAndAddSurroundingCell(cell.NorthernNeighbor.Coordinates);
                }

                if (cell.NorthEasternNeighbor != null)
                {
                    CheckAndAddSurroundingCell(cell.NorthEasternNeighbor.Coordinates);
                }

                if (cell.NorthWesternNeighbor != null)
                {
                    CheckAndAddSurroundingCell(cell.NorthWesternNeighbor.Coordinates);
                }

                if (cell.SouthernNeighbor != null)
                {
                    CheckAndAddSurroundingCell(cell.SouthernNeighbor.Coordinates);
                }

                if (cell.SouthEasternNeighbor != null)
                {
                    CheckAndAddSurroundingCell(cell.SouthEasternNeighbor.Coordinates);
                }

                if (cell.SouthWesternNeighbor != null)
                {
                    CheckAndAddSurroundingCell(cell.SouthWesternNeighbor.Coordinates);
                }
            }
        }
        #region Debug
        if (DebugSettings.DebugZoneSurrounding)
        {
            foreach (Vector2Int coordinate in surroundingCellCoordinates)
            {
                if (DebugSettings.DebugZoneSurrounding)
                {
                    LandMap.SetTile(new Vector3Int(
                                        coordinate.x - spawnLocation.x,
                                        coordinate.y - spawnLocation.y,
                                        0),
                                    DebugSettings.DebugZoneSurroundingTile);
                }
            }
        }
        #endregion
    }
コード例 #34
0
ファイル: World.cs プロジェクト: CJRutter/LudumDare45
    public float GetTileBlockingValue(int x, int y)
    {
        WorldCell cell = GetCell(x, y, CellLayer.Foreground);

        return(cell.LightBlock);
    }
コード例 #35
0
ファイル: Renderer2D.cs プロジェクト: dav793/2D-SurvivalRPG
 public override void unrenderCell(WorldCell cell)
 {
     cell.getRenderObject().terminate ();
     worldObjectPool.push (cell.getRenderObject().gameObject);
     cell.detachRenderObject ();
 }
コード例 #36
0
 void detachObject()
 {
     cell_object = null;
 }
コード例 #37
0
    private void ConnectDiagonalNeighbors(WorldCell cell, bool isYValueEven)
    {
        // If the y (vertical) value is EVEN, then the "adjacent" horizontal cells (cells located at x, y-1 and x, y+1)
        // will be shifted slightly NORTH of the center cell.
        // If the y (vertical) value is ODD, then the "adjacent" horizontal cells (cells located at x, y-1 and x, y+1)
        // will be shifted slightly SOUTH of the center cell.
        int       adjustment = (isYValueEven) ? 0 : 1;
        int       northX = cell.Coordinates.x + adjustment;
        int       southX = northX - 1;
        int       eastY = cell.Coordinates.y + 1;
        int       westY = cell.Coordinates.y - 1;
        WorldCell nwholder, swholder, neholder, seholder;

        int h = Height;
        int w = Width;

        try {
            // Handle westward directions.
            if (westY >= 0)
            {
                // TODO REDO ALL OF THIS LOGIC TO WORK RIGHT.
                // TODO IT IS ALL WRONG; GOTTA REDO
                // Northwest
                nwholder
                    = (northX < Height)
                    ? GetCell(
                          northX,
                          westY
                          )
                    : null;
                cell.NorthWesternNeighbor = nwholder;

                // Southwest
                swholder
                    = (southX >= 0)
                    ? GetCell(
                          southX,
                          westY
                          )
                    : null;
                cell.SouthWesternNeighbor = swholder;
            }

            // Handle eastward directions.
            if (eastY < Width)
            {
                // Northeast
                neholder
                    = (northX < Height)
                    ? GetCell(
                          northX,
                          eastY
                          )
                    : null;
                cell.NorthEasternNeighbor = neholder;

                // Southeast
                seholder
                    = (southX >= 0)
                    ? GetCell(
                          southX,
                          eastY
                          )
                    : null;
                cell.SouthEasternNeighbor = seholder;
            }
        }
        catch (System.Exception e)
        {
        }
    }
コード例 #38
0
    public Vector2 Redirect(List<Vector2> positions, List<float> perlinValues, WorldCell cell)
    {
        if(ActiveCells.Count > 0)
        {
            for(int i = ActiveCells.Count - 1; i >= 0; i--)
            {
                if(ActiveCells[i] != cell)
                {
                    ActiveCells[i].CheckPlayer();
                }
            }
        }

        if(pooledObjects.Count > 0)
        {
            for(int i = 0, j = 0; i < positions.Count && j < perlinValues.Count; i++, j++)
            {
                if(i >= pooledObjects.Count)
                {
                    pooledObjects.RemoveRange(0, i);
                    return new Vector2(i,j);
                }

                pooledObjects[i].gameObject.transform.parent = cell.parent.transform;
                Asteroid pooledAsteroid = pooledObjects[i].GetComponent<Asteroid>();
                pooledAsteroid.assignedPosition = positions[i];
                pooledAsteroid.perlinValue = perlinValues[i];
                pooledAsteroid.parentCell = cell;
                pooledAsteroid.Change();

                cell.children.Add(pooledObjects[i].gameObject);
                usedPooledObjects.Add(pooledObjects[i].gameObject);
            }
            pooledObjects.RemoveRange(0, positions.Count);
            return new Vector2 (-1, -1);
        }
        return new Vector2(0, 0);
    }
コード例 #39
0
 void attachObject(WorldCell cell)
 {
     cell_object = cell;
 }
コード例 #40
0
    void serializeCellData(SerializableCell copyTo, WorldCell copyFrom)
    {
        // save cell indexes
        copyTo.x = copyFrom.x;
        copyTo.y = copyFrom.y;
        copyTo.z = copyFrom.z;

        // save sprite ids
        Dictionary<string, int> sprite_ids = copyFrom.getRenderData ().sprite_ids;
        foreach (KeyValuePair<string, int> sprite in sprite_ids) {
            SerializableSpriteId spr = new SerializableSpriteId();
            spr.id = sprite.Key;
            spr.y = sprite.Value;
            copyTo.sprite_ids.Add(spr);
        }
    }
コード例 #41
0
    void PathFromZoneToZone(Zone startZone, Zone endZone, TileBase groundTile)
    {
        System.Random randy = new System.Random();

        // Determine direction from start to end, which also determines which edge/corner to use.
        // Consequencely, this determines the endzone edge/corner to use.
        HexDirection pathDirection = Direction.GetDirection(startZone.spawnLocation, endZone.spawnLocation);

        // Get all the cells along the edge closest to our target.
        List <Vector2Int> startEdge = SelectDirectionalEdge(startZone, pathDirection);
        List <Vector2Int> endEdge   = SelectDirectionalEdge(endZone, Direction.Opposite(pathDirection));

        // Choose a random cell along the appropriate edge, these will be the end points of the path.
        Vector2Int startCoordinates = startEdge[randy.Next(startEdge.Count)];
        Vector2Int endCoordinates   = endEdge[randy.Next(endEdge.Count)];

        world.GetCell(startCoordinates).special = SpecialType.Path;
        world.GetCell(endCoordinates).special   = SpecialType.Path;

        HexDirection nextDirection = pathDirection;
        WorldCell    currentCell   = world.GetCell(startCoordinates).GetNeighbor(pathDirection);

        currentCell.special = SpecialType.Path;

        // cycle through the cells, starting from startCell, and heading towards pathDirection.
        bool NeighborIsEndCoordinates = false;

        while (!NeighborIsEndCoordinates)
        {
            foreach (WorldCell neighbor in currentCell.GetListOfNeighbors())
            {
                if (endCoordinates == neighbor.Coordinates)
                {
                    NeighborIsEndCoordinates = true;
                }
            }

            if (!NeighborIsEndCoordinates)
            {
                // TODO handle out of bounds properly.
                // TODO don't select a cell we've already done in this loop.
                bool      validNextCell = false;
                WorldCell nextCell      = null;
                while (!validNextCell)
                {
                    // TODO randomly determine which direction we will be going, offset from the nextDirection (or exactly equal to nextDirection)
                    nextDirection = GetNextDirection(Direction.GetDirection(currentCell.Coordinates, endCoordinates));
                    nextCell      = currentCell.GetNeighbor(nextDirection);
                    validNextCell = true;
                }
                currentCell = nextCell;

                // Build the path with what we found.
                currentCell.special = SpecialType.Path;
                #region Debug
                if (DebugSettings.DebugPath)
                {
                    tilemap.SetTile(new Vector3Int(currentCell.Coordinates.x, currentCell.Coordinates.y, 0), DebugSettings.DebugPathTile);
                    // tm.SetTile(new Vector3Int(coords.x, coords.y, 0), DebugSettings.DebugPathTile);
                }
                else
                {
                    tilemap.SetTile(new Vector3Int(currentCell.Coordinates.x, currentCell.Coordinates.y, 0), groundTile);
                }
                #endregion
                // todo chance for "extra" things to appear on the side.
            }
        }
    }