Ejemplo n.º 1
0
    public void moveToSlot(int c, int r, bool earlyCreation = false)
    {
        int  previousCol = colPos;
        int  previousRow = rowPos;
        bool slotEmpty   = false;

        if (StageScript.isSlotEmpty(c, r))
        {
            slotEmpty = true;
            StageScript.addCharacterToSlot(c, r, heroType);

            if (colPos >= 0 && rowPos >= 0)
            {
                StageScript.emptySlot(colPos, rowPos);
            }

            colPos = c; rowPos = r;
        }

        if (colPos < 0 || rowPos < 0)
        {
            buildBench.GetComponent <BuildManagerScript>().updatePositions();
        }
        else
        {
            transform.position = new Vector2(StageScript.cols [colPos], StageScript.rows [rowPos]);
            if (slotEmpty)
            {
                didMoveToSlot(c, r, previousCol, previousRow, earlyCreation);
            }
        }
    }