Example #1
0
    void ShowPath(int speed)
    {
        if (currentPathExists)
        {
            HexCell current = currentPathTo;
            while (current != currentPathFrom)
            {
                int turn = (current.Distance - 1) / speed;
                current.SetLabel(turn.ToString());
                current.EnableOutline(Color.green);
                current = current.PathFrom;
            }
        }

        currentPathFrom.EnableOutline(Color.blue);
        currentPathTo.EnableOutline(Color.red);
    }
Example #2
0
    public void ClearPath()
    {
        if (currentPathExists)
        {
            HexCell current = currentPathTo;
            while (current != currentPathFrom)
            {
                current.SetLabel(null);
                current.EnableOutline(Color.white);
                // current.DisableOutline();
                current = current.PathFrom;
            }

            current.DisableOutline();
            currentPathExists = false;
        }
        else if (currentPathFrom)
        {
            currentPathFrom.EnableOutline(Color.white);
            currentPathTo.EnableOutline(Color.white);
        }

        currentPathFrom = currentPathTo = null;
    }