示例#1
0
    protected override Vector3 AttemptMove(Layer2D layer, Direction dir)
    {
        var move = base.AttemptMove(layer, dir);

        // スタミナを減らす
        _stamina--;
        InGameManager.GetInstance().staminaText.text = "Stamina: " + Stamina;

        CheckIfGameOver();

        // ゴールがある場合リロード
        if (InGameManager.GetInstance().GoalCheck(ChipUtil.GetChipPos(new Vector2(move.x, move.y))))
        {
            // 遅延してリスタート
            Restart();

            // プレイヤーを一度無効
            enabled = false;
        }

        // プレイヤーのターンを終了する
        InGameManager.GetInstance().playersTurn = false;

        return(move);
    }
示例#2
0
    public override void Generate(List <Layer2D> layer)
    {
        // データ取得
        WIDTH  = layer[(int)LayerType.Under].Width;
        HEIGHT = layer[(int)LayerType.Under].Height;

        // 生成可能位置リストを取得
        var popList = new List <KeyValuePair <int, int> >();

        popList = GetGeneratedList(layer[(int)LayerType.Under]);

        // 生成可能位置にプレイヤーを作成

        int rand = Random.Range(0, popList.Count - 1);

        var token = Util.CreateToken(0.0f, 0.0f, "Sprites\\Tile\\goal", "", "Goal");

        token.Renderer.sortingOrder = 1;
        var x = popList[rand].Key;
        var y = popList[rand].Value;

        layer[(int)LayerType.Top].Set(x, y, (int)ChipType.Goal);
        token.SetPosition(ChipUtil.GetChipPos(new Vector2(x, y)));
    }
示例#3
0
    public Vector2Int GetChipPosition()
    {
        var cPos = ChipUtil.GetChipPos(transform.position);

        return(cPos);
    }