Ejemplo n.º 1
0
    public Block createBlock(BlockData blockData, IntVector3 position)
    {
        GameObject blockGO = Instantiate(ResourceLookup.getBlockPrefab(), position.getVector3(), Quaternion.identity) as GameObject;
        blockGO.transform.parent = blockContainer.transform;
        Block block = blockGO.GetComponent<Block>();
        blockData.position = position;
        block.initialize(blockData);

        if (blockData.isRotationRandom)
        {
            blockGO.transform.eulerAngles = Angles.getRandom();
        }
        else
        {
            blockGO.transform.eulerAngles = Angles.getFlat();
        }
        //blockGO.transform.parent = transform;
        blockGameObjects[position.x, position.y, position.z] = blockGO;

        return block;
    }
Ejemplo n.º 2
0
    public Block createBlock(BlockData blockData, IntVector3 position)
    {
        GameObject blockGO = Instantiate(ResourceLookup.getBlockPrefab(), position.getVector3(), Quaternion.identity) as GameObject;

        blockGO.transform.parent = blockContainer.transform;
        Block block = blockGO.GetComponent <Block>();

        blockData.position = position;
        block.initialize(blockData);

        if (blockData.isRotationRandom)
        {
            blockGO.transform.eulerAngles = Angles.getRandom();
        }
        else
        {
            blockGO.transform.eulerAngles = Angles.getFlat();
        }
        //blockGO.transform.parent = transform;
        blockGameObjects[position.x, position.y, position.z] = blockGO;

        return(block);
    }