Example #1
0
        public static void Unload()
        {
            var rm = ResourceSystem.Instance;

            Paw.Unload();
            Cursor.Unload();
        }
Example #2
0
        //-------------------------------------------------------------------------
        // Load, Unload

        public static void Load(System.Action pre, System.Action done)
        {
            var rm = ResourceSystem.Instance;

            Paw.Load(pre, done);
            Cursor.Load(pre, done);
        }
            //-------------------------------------------------------------------------
            // メソッド

            /// <summary>
            /// コンストラクタ
            /// </summary>
            public StatusInvisible(Paw paw)
            {
                this.paw = paw;

                this.state.Add(State.Idle, OnIdleEnter);
                this.state.Add(State.FadeIn, OnFadeInEnter, OnFadeInUpdate);
                this.state.Add(State.Usual, OnUsualEnter, OnUsualUpdate);
                this.state.Add(State.FadeOut, OnFadeOutEnter, OnFadeOutUpdate);
                this.state.SetState(State.Idle);
            }
Example #4
0
        /// <summary>
        /// x,yの位置にある肉球から繋がれている肉球の数を調べ上げる
        /// </summary>
        private void LookUpPawConnectable(int x, int y, ref int count)
        {
            // 連結数をカウントアップ
            count++;

            // 繋がりをみる肉球をいれておく変数
            Paw curr = this.paws[IndexBy(x, y)];
            Paw next;

            // 評価中の肉球は評価済にしておく
            curr.IsEvaluated = true;

            // 上方向の繋がりをみる
            if (y < Define.Versus.PAW_ROW - 1)
            {
                next = this.paws[IndexBy(x, y + 1)];
                if (!next.IsEvaluated && curr.CanConnect(next))
                {
                    LookUpPawConnectable(x, y + 1, ref count);
                }
            }

            // 下方向のつながりを見る
            if (0 < y)
            {
                next = this.paws[IndexBy(x, y - 1)];
                if (!next.IsEvaluated && curr.CanConnect(next))
                {
                    LookUpPawConnectable(x, y - 1, ref count);
                }
            }

            // 左方向のつながりを見る
            if (0 < x)
            {
                next = this.paws[IndexBy(x - 1, y)];
                if (!next.IsEvaluated && curr.CanConnect(next))
                {
                    LookUpPawConnectable(x - 1, y, ref count);
                }
            }

            // 右方向のつながりを見る
            if (x < Define.Versus.PAW_COL - 1)
            {
                next = this.paws[IndexBy(x + 1, y)];
                if (!next.IsEvaluated && curr.CanConnect(next))
                {
                    LookUpPawConnectable(x + 1, y, ref count);
                }
            }
        }
Example #5
0
        /// <summary>
        /// 指定した肉球、及びその肉球に繋がっている肉球を消滅させる
        /// このメソッドはLookUpPadConnectionによって肉球のつながりを調べた後に使用すること
        /// </summary>
        private void Vanish(int x, int y)
        {
            // 肉球
            Paw curr = this.paws[IndexBy(x, y)];
            Paw next;

            // 評価フラグを落とし、消滅状態へ設定する
            curr.IsEvaluated = false;
            curr.ToVanish();

            // 上方向を消していく
            if (y < Define.Versus.PAW_ROW - 1)
            {
                next = this.paws[IndexBy(x, y + 1)];
                if (next.IsEvaluated && curr.CanConnect(next))
                {
                    Vanish(x, y + 1);
                }
            }

            // 下方向を消していく
            if (0 < y)
            {
                next = this.paws[IndexBy(x, y - 1)];
                if (next.IsEvaluated && curr.CanConnect(next))
                {
                    Vanish(x, y - 1);
                }
            }

            // 左方向を消していく
            if (0 < x)
            {
                next = this.paws[IndexBy(x - 1, y)];
                if (next.IsEvaluated && curr.CanConnect(next))
                {
                    Vanish(x - 1, y);
                }
            }

            // 右方向を消していく
            if (x < Define.Versus.PAW_COL - 1)
            {
                next = this.paws[IndexBy(x + 1, y)];
                if (next.IsEvaluated && curr.CanConnect(next))
                {
                    Vanish(x + 1, y);
                }
            }
        }
Example #6
0
        /// <summary>
        /// 肉球の評価フラグを再帰的に落とす
        /// </summary>
        private void ClearEvaluated(int x, int y)
        {
            // 繋がりをみる肉球をいれておく変数
            Paw curr = this.paws[IndexBy(x, y)];
            Paw next;

            // 評価フラグを落とす
            curr.IsEvaluated = false;

            // 上方向の繋がりをみる
            if (y < Define.Versus.PAW_ROW - 1)
            {
                next = this.paws[IndexBy(x, y + 1)];
                if (next.IsEvaluated)
                {
                    ClearEvaluated(x, y + 1);
                }
            }

            // 下方向のつながりを見る
            if (0 < y)
            {
                next = this.paws[IndexBy(x, y - 1)];
                if (next.IsEvaluated)
                {
                    ClearEvaluated(x, y - 1);
                }
            }

            // 左方向のつながりを見る
            if (0 < x)
            {
                next = this.paws[IndexBy(x - 1, y)];
                if (next.IsEvaluated)
                {
                    ClearEvaluated(x - 1, y);
                }
            }

            // 右方向のつながりを見る
            if (x < Define.Versus.PAW_COL - 1)
            {
                next = this.paws[IndexBy(x + 1, y)];
                if (next.IsEvaluated)
                {
                    ClearEvaluated(x + 1, y);
                }
            }
        }
Example #7
0
        /// <summary>
        /// 指定された肉球と繋がる事ができるかどうか
        /// </summary>
        public bool CanConnect(Paw paw)
        {
            // 凍結していたら繋がれない
            if (this.IsFreeze)
            {
                return(false);
            }

            // 属性が異なるなら繋がれない
            if (this.Attribute != paw.Attribute)
            {
                return(false);
            }

            // Idle状態なら繋がれない
            if (this.state.StateKey == State.Idle)
            {
                return(false);
            }

            return(true);
        }
Example #8
0
        /// <summary>
        /// 連鎖すると肉球が消え場所が空くので、消えてない肉球を下に詰める。
        /// </summary>
        private void StaffPawDown(int srcIndex)
        {
            // 消えてる肉球は対象外
            if (this.paws[srcIndex].IsIdle)
            {
                return;
            }

            // 肉球の移動先を調べる
            var srcCoord = CoordBy(srcIndex);
            var dstCoord = srcCoord;

            // 現在のY座標から下に向かって消えてない(Idleじゃない)肉球の一個上のY座標を求める
            for (int y = srcCoord.y - 1; 0 <= y; --y)
            {
                if (!this.paws[IndexBy(srcCoord.x, y)].IsIdle)
                {
                    break;
                }
                dstCoord.y = y;
            }

            // 移動先が同じならなにもしない
            if (srcCoord == dstCoord)
            {
                return;
            }

            // 肉球の入れ替え
            var dstIndex = IndexBy(dstCoord);
            Paw src      = this.paws[srcIndex];
            Paw dst      = this.paws[dstIndex];

            this.paws[dstIndex] = src;
            this.paws[srcIndex] = dst;
        }
Example #9
0
            //-------------------------------------------------------------------------
            // メソッド

            /// <summary>
            /// コンストラクタ
            /// </summary>
            public SwapExecutor(Paw paw)
            {
                this.paw = paw;
            }