Пример #1
0
    // 获得关闭窗户的模式
    public void     getClosingPattern(out FloorControl.CLOSING_PATTERN_TYPE out_type, out bool out_is_flip, out FloorControl.ClosingPatternParam out_param)
    {
        int  paper_num   = this.scene_control.getPaperNum();
        bool random_bool = Random.Range(0, 2) == 0 ? true : false;

        out_param.as_float = 0.0f;
        out_param.as_bool  = false;

        switch (this.level)
        {
        case LEVEL.EASY:
        {
            // easy 只有 normal

            out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

            out_is_flip = false;
        }
        break;

        case LEVEL.NORMAL:
        {
            if (9 >= paper_num && paper_num >= 8)
            {
                // 第1,2张为 NORMAL.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

                out_is_flip = false;
            }
            else if (paper_num == 7)
            {
                // 还剩下7张时为 OVERSHOOT.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.OVERSHOOT;

                out_is_flip = false;
            }
            else if (paper_num == 6)
            {
                // 还剩下6张时为 SECONDTIME.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.SECONDTIME;

                out_is_flip = false;
            }
            else if (paper_num == 5)
            {
                // 还剩下5张时为 ARCODION.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.ARCODION;

                out_is_flip = false;
            }
            else if (4 >= paper_num && paper_num >= 3)
            {
                // 还剩下4~3张时为 DELAY(is_flip 是随机)

                out_type = FloorControl.CLOSING_PATTERN_TYPE.DELAY;

                out_is_flip = random_bool;

                if (paper_num == 4)
                {
                    // 还剩4张时从右开始

                    out_param.as_bool = false;
                }
                else
                {
                    // 还剩3张时从右开始(拉门的里边开始)
                    out_param.as_bool = true;
                }
            }
            else if (paper_num == 2)
            {
                // 还剩2张时一定是 FALLDOWN.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.FALLDOWN;

                out_is_flip = false;
            }
            else
            {
                // 还剩1张时一定是 FLIP(is_flip 是随机)

                out_type = FloorControl.CLOSING_PATTERN_TYPE.FLIP;

                out_is_flip = random_bool;
            }
        }
        break;

        case LEVEL.HARD:
        {
            if (paper_num >= 8)
            {
                // 还剩9~8张时为 NORMAL.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

                if (paper_num == 9)
                {
                    out_is_flip = random_bool;
                }
                else
                {
                    out_is_flip = !this.random_bool_prev;
                }
            }
            else if (paper_num >= 5)
            {
                // 还剩7~5张时为 SLOW.
                // 关闭后渐渐变慢

                out_type = FloorControl.CLOSING_PATTERN_TYPE.SLOW;

                if (paper_num == 7)
                {
                    out_is_flip        = random_bool;
                    out_param.as_float = 1.5f;
                }
                else if (paper_num == 6)
                {
                    out_is_flip        = !this.random_bool_prev;
                    out_param.as_float = 1.7f;

                    // 为下一次做准备
                    // (使7,6,5 一定会有交互)
                    random_bool = !this.random_bool_prev;
                }
                else
                {
                    out_is_flip        = !this.random_bool_prev;
                    out_param.as_float = 2.0f;
                }
            }
            else
            {
                // 还剩4~1张时 SUPER_DELAY.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.SUPER_DELAY;

                out_is_flip = random_bool;

                if (paper_num >= 4)
                {
                    out_param.as_float = 0.6f;
                }
                else if (paper_num >= 3)
                {
                    out_param.as_float = 0.7f;
                }
                else
                {
                    out_param.as_float = 0.9f;
                }
            }
        }
        break;

        default:
        {
            out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

            out_is_flip = false;
        }
        break;
        }

        this.random_bool_prev = random_bool;
    }
Пример #2
0
    // 障子の閉まり方パターンを取得する.
    public void     getClosingPattern(out FloorControl.CLOSING_PATTERN_TYPE out_type, out bool out_is_flip, out FloorControl.ClosingPatternParam out_param)
    {
        int  paper_num   = this.scene_control.getPaperNum();
        bool random_bool = Random.Range(0, 2) == 0 ? true : false;

        out_param.as_float = 0.0f;
        out_param.as_bool  = false;

        switch (this.level)
        {
        case LEVEL.EASY:
        {
            // easy は normal のみ.

            out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

            out_is_flip = false;
        }
        break;

        case LEVEL.NORMAL:
        {
            if (9 >= paper_num && paper_num >= 8)
            {
                // 1、2枚目は NORMAL.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

                out_is_flip = false;
            }
            else if (paper_num == 7)
            {
                // 残り7枚のときは OVERSHOOT.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.OVERSHOOT;

                out_is_flip = false;
            }
            else if (paper_num == 6)
            {
                // 残り6枚のときは SECONDTIME.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.SECONDTIME;

                out_is_flip = false;
            }
            else if (paper_num == 5)
            {
                // 残り5枚のときは ARCODION.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.ARCODION;

                out_is_flip = false;
            }
            else if (4 >= paper_num && paper_num >= 3)
            {
                // 残り4~3枚のときは DELAY(is_flip はランダム).

                out_type = FloorControl.CLOSING_PATTERN_TYPE.DELAY;

                out_is_flip = random_bool;

                if (paper_num == 4)
                {
                    // 残り4枚のときは右から.

                    out_param.as_bool = false;
                }
                else
                {
                    // 残り3枚のときは右から(ふすまの裏から).
                    out_param.as_bool = true;
                }
            }
            else if (paper_num == 2)
            {
                // 残り2枚の時は FALLDOWN.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.FALLDOWN;

                out_is_flip = false;
            }
            else
            {
                // 残り1枚の時は FLIP(is_flip はランダム).

                out_type = FloorControl.CLOSING_PATTERN_TYPE.FLIP;

                out_is_flip = random_bool;
            }
        }
        break;

        case LEVEL.HARD:
        {
            if (paper_num >= 8)
            {
                // 残り9~8枚のときは NORMAL.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

                if (paper_num == 9)
                {
                    out_is_flip = random_bool;
                }
                else
                {
                    out_is_flip = !this.random_bool_prev;
                }
            }
            else if (paper_num >= 5)
            {
                // 残り7~5枚のときは SLOW.
                // 閉まり終わるのがだんだん遅くなる.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.SLOW;

                if (paper_num == 7)
                {
                    out_is_flip        = random_bool;
                    out_param.as_float = 1.5f;
                }
                else if (paper_num == 6)
                {
                    out_is_flip        = !this.random_bool_prev;
                    out_param.as_float = 1.7f;

                    // 次回のために上書きしておく.
                    // (7, 6, 5 で必ず交互になるように).
                    random_bool = !this.random_bool_prev;
                }
                else
                {
                    out_is_flip        = !this.random_bool_prev;
                    out_param.as_float = 2.0f;
                }
            }
            else
            {
                // 残り4~1枚のときは SUPER_DELAY.

                out_type = FloorControl.CLOSING_PATTERN_TYPE.SUPER_DELAY;

                out_is_flip = random_bool;

                if (paper_num >= 4)
                {
                    out_param.as_float = 0.6f;
                }
                else if (paper_num >= 3)
                {
                    out_param.as_float = 0.7f;
                }
                else
                {
                    out_param.as_float = 0.9f;
                }
            }
        }
        break;

        default:
        {
            out_type = FloorControl.CLOSING_PATTERN_TYPE.NORMAL;

            out_is_flip = false;
        }
        break;
        }

        this.random_bool_prev = random_bool;
    }