Exemplo n.º 1
0
        private bool tryPost(ref Model.Piece model, out string errMsg)
        {
            errMsg = "";
            bool re = false;

            model.Creater      = this.auth.UserId;
            model.CreatedDate  = DateTime.Now;
            model.Modifier     = this.auth.UserId;
            model.ModifiedDate = DateTime.Now;
            if (PieceManager.AddPiece(ref model, out errMsg))
            {
                re = true;
            }
            return(re);
        }
Exemplo n.º 2
0
    // Constructor
    public Track(GameManager gm, PlayerType owner)
    {
        gameManager = gm;
        this.owner  = owner;

        // Create the Piece objects
        for (int i = 0; i < PIECE_COUNT; i++)
        {
            // Determine the proper storage location based on owner
            // Then create a new Piece at that storage location
            stoneStorage = (owner == PlayerType.Player1) ? gameManager.player1StoneStorage : gameManager.player2StoneStorage;
            Piece newPiece = gameManager.CreatePiece(stoneStorage.position, Quaternion.identity).GetComponent <Piece>();

            // GameObject stuff
            newPiece.gameObject.name = owner.ToString() + " Piece " + i;
            newPiece.transform.SetParent(stoneStorage);

            // Piece initializations
            newPiece.Initialize(i, owner);

            // Adding this Piece to the PieceManager
            pieceManager.AddPiece(newPiece, null);
        }

        // Create the Tiles
        /// For the first 4 Tiles and last 2 Tiles in this players Track,
        /// assign thier owner to the corresponding owner.
        /// For the other Tiles, make thier ownership BOTH.
        for (int i = 0; i < 14; i++)
        {
            if ((i >= 0 && i <= 3) || i == 12 || i == 13)
            {
                string tileObjectKey = "Tile " + owner.ToString() + " " + i;
                tiles[i] = new Tile(owner, i, GameObject.Find(tileObjectKey).transform);
            }
            else
            {
                tiles[i] = gameManager.centerTiles[i - 4];
            }
        }

        // Create the final destination Tile for scoring
        finalDestinationTile = new Tile(true, owner);
    }
Exemplo n.º 3
0
 public void CreatePiece()
 {
     pm.AddPiece(x, y);
 }