Beispiel #1
0
    // Plant a block so that it can't be moved again
    public static void Plant(Block block)
    {
        BlockManager.RemoveActive(block);

        foreach (GameObject cube in block.cubes)
        {
            cube.transform.SetParent(null);
            IntegerVector3 index = WorldSpaceToIndex(cube.transform.position, false);
            index.Set(blocks, cube);
            index.Set(occupied, new OccupationState(OccupationState.Type.Planted, block.id));

            if (index.At(occupied).GetID() != block.id)
            {
                Debug.Log(string.Format("! {0}", index.At(occupied).GetID()));
            }
        }

        Object.Destroy(block.gameObject);

        RemovePlanes();

        if (IsFull())
        {
            main.Invoke("EndGame", 0);
        }
    }