コード例 #1
0
ファイル: OrientedBlock.cs プロジェクト: Hengle/Maze-1
    public GameObject Editor_RemoveFromBlockSet(BlockOrientation orientation, GameObject blockObject)
    {
        BlockSet targetSet = GetSetForOrientation(orientation, true);

        if (targetSet == null)
        {
            return(null);
        }

        GameObject returnObject = targetSet.Editor_RemoveFromBlockSet(blockObject);

        if (!targetSet.HasBlocks())
        {
            targetSet.SetIsDefault(false);

            BlockSet[] bs = GetBlockSetsAsArray();

            for (int i = 0; i < bs.Length; i++)
            {
                if (bs[i].HasBlocks())
                {
                    bs[i].SetIsDefault(true);
                    break;
                }
            }
        }

        return(returnObject);
    }
コード例 #2
0
ファイル: OrientedBlock.cs プロジェクト: Hengle/Maze-1
    public void SetBlockOrientation(BlockOrientation orientation, bool refresh)
    {
        if (this.orientation == (int)orientation && !refresh)
        {
            return;
        }

        Hide();

        //Remove this. This is just so i can... look. O_O
        if (orientation != BlockOrientation.Default)
        {
            this.orientation = (int)orientation;
        }

        BlockSet chosenSet = GetSetForOrientation(orientation, false);

        if (chosenSet == null)
        {
            BlockSet d = GetDefaultSet();

            if (d != null)
            {
                chosenSet = d;
            }
            else
            {
                //
//#if UNITY_4_0
                gameObject.SetActive(true);
//#else
//				gameObject.active = true;
//#endif
//				return;
            }
        }

        if (!chosenSet.HasBlocks())
        {
            if (orientation == BlockOrientation.Default)
            {
            }
            else
            {
                SetBlockOrientation(BlockOrientation.Default, true);
            }

            return;
        }

        chosenSet.Show();

//#if UNITY_4_0
        gameObject.SetActive(true);
//#else
//		gameObject.active = true;
//#endif

        BindChildrenToBlock();
    }
コード例 #3
0
ファイル: OrientedBlock.cs プロジェクト: Hengle/Maze-1
    public BlockSet GetSetForOrientation(BlockOrientation orientation, bool includeEmptySets)
    {
        BlockSet targetSet = null;

        switch (orientation)
        {
        case BlockOrientation.Bottom_Alone: {
            targetSet = Bottom_Alone;

            break;
        }

        case BlockOrientation.Bottom_Left: {
            targetSet = Bottom_Left;

            break;
        }

        case BlockOrientation.Bottom_Right: {
            targetSet = Bottom_Right;

            break;
        }

        case BlockOrientation.Bottom_Surrounded: {
            targetSet = Bottom_Surrounded;

            break;
        }

        case BlockOrientation.Centre_Alone: {
            targetSet = Centre_Alone;

            break;
        }

        case BlockOrientation.Centre_Horizontal_Surrounded: {
            targetSet = Centre_Horizontal_Surrounded;

            break;
        }

        case BlockOrientation.Centre_Surrounded: {
            targetSet = Centre_Surrounded;

            break;
        }

        case BlockOrientation.Centre_Vertical_Surrounded: {
            targetSet = Centre_Vertical_Surrounded;

            break;
        }

        case BlockOrientation.Left_Alone: {
            targetSet = Left_Alone;

            break;
        }

        case BlockOrientation.Left_Surrounded: {
            targetSet = Left_Surrounded;

            break;
        }

        case BlockOrientation.Right_Alone: {
            targetSet = Right_Alone;

            break;
        }

        case BlockOrientation.Right_Surrounded: {
            targetSet = Right_Surrounded;

            break;
        }

        case BlockOrientation.Top_Alone: {
            targetSet = Top_Alone;

            break;
        }

        case BlockOrientation.Top_Left: {
            targetSet = Top_Left;

            break;
        }

        case BlockOrientation.Top_Right: {
            targetSet = Top_Right;

            break;
        }

        case BlockOrientation.Top_Surrounded: {
            targetSet = Top_Surrounded;

            break;
        }

        case BlockOrientation.Bottom_Left_Inner_Corner: {
            targetSet = Bottom_Left_Inner_Corner;

            break;
        }

        case BlockOrientation.Bottom_Right_Inner_Corner: {
            targetSet = Bottom_Right_Inner_Corner;

            break;
        }

        case BlockOrientation.Top_Left_Inner_Corner: {
            targetSet = Top_Left_Inner_Corner;

            break;
        }

        case BlockOrientation.Top_Right_Inner_Corner: {
            targetSet = Top_Right_Inner_Corner;

            break;
        }

        case BlockOrientation.Left_Diagonal: {
            targetSet = Left_Diagonal;

            break;
        }

        case BlockOrientation.Right_Diagonal: {
            targetSet = Right_Diagonal;

            break;
        }

        case BlockOrientation.Lower_Left_Filled_Diagonal: {
            targetSet = Lower_Left_Filled_Diagonal;

            break;
        }

        case BlockOrientation.Lower_Right_Filled_Diagonal: {
            targetSet = Lower_Right_Filled_Diagonal;

            break;
        }

        case BlockOrientation.Upper_Left_Filled_Diagonal: {
            targetSet = Upper_Left_Filled_Diagonal;

            break;
        }

        case BlockOrientation.Upper_Right_Filled_Diagonal: {
            targetSet = Upper_Right_Filled_Diagonal;

            break;
        }

        case BlockOrientation.Cross_Hub: {
            targetSet = Cross_Hub;
            break;
        }

        case BlockOrientation.Downward_T_Hub: {
            targetSet = Downward_T_Hub;
            break;
        }

        case BlockOrientation.Upward_T_Hub: {
            targetSet = Upward_T_Hub;
            break;
        }

        case BlockOrientation.Leftward_T_Hub: {
            targetSet = Leftward_T_Hub;
            break;
        }

        case BlockOrientation.Rightward_T_Hub: {
            targetSet = Rightward_T_Hub;
            break;
        }

        //Gee. Regrets
        //There was probably a better way to do this
        //But here we are
        case BlockOrientation.Border_Bottom_Left: {
            targetSet = Border_Bottom_Left;
            break;
        }

        case BlockOrientation.Border_Bottom_Right: {
            targetSet = Border_Bottom_Right;
            break;
        }

        case BlockOrientation.Border_Top_Left: {
            targetSet = Border_Top_Left;
            break;
        }

        case BlockOrientation.Border_Top_Right: {
            targetSet = Border_Top_Right;
            break;
        }

        case BlockOrientation.Diagonal_Gate_Left: {
            targetSet = Diagonal_Gate_Left;
            break;
        }

        case BlockOrientation.Diagonal_Gate_Right: {
            targetSet = Diagonal_Gate_Right;
            break;
        }

        case BlockOrientation.Fork_Bottom_Left: {
            targetSet = Fork_Bottom_Left;
            break;
        }

        case BlockOrientation.Fork_Bottom_Right: {
            targetSet = Fork_Bottom_Right;
            break;
        }

        case BlockOrientation.Fork_Top_Left: {
            targetSet = Fork_Top_Left;
            break;
        }

        case BlockOrientation.Fork_Top_Right: {
            targetSet = Fork_Top_Right;
            break;
        }

        case BlockOrientation.Funnel_Bottom: {
            targetSet = Funnel_Bottom;
            break;
        }

        case BlockOrientation.Funnel_Left: {
            targetSet = Funnel_Left;
            break;
        }

        case BlockOrientation.Funnel_Right: {
            targetSet = Funnel_Right;
            break;
        }

        case BlockOrientation.Funnel_Top: {
            targetSet = Funnel_Top;
            break;
        }

        case BlockOrientation.Taper_Bottom_Left: {
            targetSet = Taper_Bottom_Left;
            break;
        }

        case BlockOrientation.Taper_Bottom_Right: {
            targetSet = Taper_Bottom_Right;
            break;
        }

        case BlockOrientation.Taper_Left_Bottom: {
            targetSet = Taper_Left_Bottom;
            break;
        }

        case BlockOrientation.Taper_Left_Top: {
            targetSet = Taper_Left_Top;
            break;
        }

        case BlockOrientation.Taper_Right_Bottom: {
            targetSet = Taper_Right_Bottom;
            break;
        }

        case BlockOrientation.Taper_Right_Top: {
            targetSet = Taper_Right_Top;
            break;
        }

        case BlockOrientation.Taper_Top_Left: {
            targetSet = Taper_Top_Left;
            break;
        }

        case BlockOrientation.Taper_Top_Right: {
            targetSet = Taper_Top_Right;
            break;
        }
        }

        if (targetSet == null || !targetSet.HasBlocks() && !includeEmptySets)
        {
            targetSet = GetDefaultSet();
        }

        return(targetSet);
    }