Ejemplo n.º 1
0
    private void SwitchBrickToType(BaseBrick brick, BrickType type)
    {
        GameObject obj = levelLogic.GetBrickBasedOnType(type);

        BrickData newData = new BrickData {
            gridNodeID = brick.GetComponent <BaseBrick>().ID,
            type       = type
        };
        BaseBrick newB = obj.GetComponent <BaseBrick>();

        newB.Initialize(newData);
        newB.SwitchPositions(brick.transform.position);
        obj.transform.SetParent(brickGridParent);
        ReplaceInLevel(brick, newB);

        if (type == BrickType.PATH)
        {
            brick.SwitchToPath();
        }
    }