コード例 #1
0
 //Quando o jogo começa essa função é chamada
 public void Start()
 {
     provider = FindObjectOfType <PieceProvider>();
     panel    = GameObject.Find("EndGamePanel");
     panel.SetActive(false);
     //Cria cada peça com seu x e y
     PlayerWhite = new GameObject[] { provider.Create("white_rook1", 0, 0, TiposPeca.rook),
                                      provider.Create("white_knight1", 1, 0, TiposPeca.knight), provider.Create("white_bishop1", 2, 0, TiposPeca.bishop)
                                      , provider.Create("white_queen1", 3, 0, TiposPeca.queen),
                                      provider.Create("white_king1", 4, 0, TiposPeca.king),
                                      provider.Create("white_bishop2", 5, 0, TiposPeca.bishop), provider.Create("white_knight2", 6, 0, TiposPeca.knight),
                                      provider.Create("white_rook2", 7, 0, TiposPeca.rook),
                                      provider.Create("white_pawn1", 0, 1, TiposPeca.white_pawn),
                                      provider.Create("white_pawn2", 1, 1, TiposPeca.white_pawn), provider.Create("white_pawn3", 2, 1, TiposPeca.white_pawn),
                                      provider.Create("white_pawn4", 3, 1, TiposPeca.white_pawn), provider.Create("white_pawn5", 4, 1, TiposPeca.white_pawn),
                                      provider.Create("white_pawn6", 5, 1, TiposPeca.white_pawn), provider.Create("white_pawn7", 6, 1, TiposPeca.white_pawn),
                                      provider.Create("white_pawn8", 7, 1, TiposPeca.white_pawn) };
     PlayerBlack = new GameObject[] { provider.Create("black_rook1", 0, 7, TiposPeca.rook),
                                      provider.Create("black_knight1", 1, 7, TiposPeca.knight), provider.Create("black_bishop1", 2, 7, TiposPeca.bishop),
                                      provider.Create("black_queen1", 3, 7, TiposPeca.queen),
                                      provider.Create("black_king1", 4, 7, TiposPeca.king),
                                      provider.Create("black_bishop2", 5, 7, TiposPeca.bishop), provider.Create("black_knight2", 6, 7, TiposPeca.knight),
                                      provider.Create("black_rook2", 7, 7, TiposPeca.rook)
                                      , provider.Create("black_pawn1", 0, 6, TiposPeca.black_pawn), provider.Create("black_pawn2", 1, 6, TiposPeca.black_pawn),
                                      provider.Create("black_pawn3", 2, 6, TiposPeca.black_pawn), provider.Create("black_pawn4", 3, 6, TiposPeca.black_pawn),
                                      provider.Create("black_pawn5", 4, 6, TiposPeca.black_pawn), provider.Create("black_pawn6", 5, 6, TiposPeca.black_pawn),
                                      provider.Create("black_pawn7", 6, 6, TiposPeca.black_pawn), provider.Create("black_pawn8", 7, 6, TiposPeca.black_pawn) };
     //Coloca cada peça na matriz
     for (int i = 0; i < PlayerBlack.Length; i++)
     {
         SetPosition(PlayerBlack[i]);
         SetPosition(PlayerWhite[i]);
     }
 }
コード例 #2
0
        //
        // GET: /Game/

        public ActionResult Index()
        {
            PieceProvider      pieceProvider = new PieceProvider();
            List <EntityPiece> pieces        = pieceProvider.GetAllPieces();

            return(View(pieces));
        }
コード例 #3
0
        public ActionResult UpdatePiece(int ID, int x, int y)
        {
            PieceProvider pieceProvider = new PieceProvider();

            pieceProvider.UpdatePosition(ID, x, y);
            return(RedirectToAction("Index"));
        }
コード例 #4
0
    private void ObserveOneself(PlayerAction action, PieceProvider pieceObj)
    {
        pieceObj.ChangeAttackIcon(true);
        var stream = pieceObj.pieceButton
                     .OnClickAsObservable().Subscribe(_ =>
        {
            action.Action = PieceAction.Attack;
            MessageBroker.Default.Publish(action);
        });

        _compositeDisposable.Add(stream);
    }