Example #1
0
    void ProcessBlocks()
    {
        foreach (Transform block in blocksContainer)
        {
            // Let the DungeonRoom know about the blocks it contains
            DungeonRoom dr = DungeonRoom.GetRoomForPosition(block.position);
            if (dr != null)
            {
                dr.AddBlock(block.gameObject);
            }

            // Scale blocks accordingly, and position so they touch ground
            if (block.gameObject.layer != LayerMask.NameToLayer(ZeldaLayers.INVISIBLE_BLOCKS))
            {
                block.localScale = new Vector3(block.localScale.x, _shortBlockHeight, block.localScale.z);
                block.SetLocalY(_shortBlockHeight * 0.5f);
                block.GetComponent <Renderer>().material.mainTextureScale = new Vector2(1, _shortBlockHeight);
            }
        }
    }