Esempio n. 1
0
        public static void GetFreeSlots()
        {
            ParkItems.Clear();
            DockItems.Clear();

            using var conn = new SqlConnection(Properties.Settings.Default.ConnectionString);

            conn.Open();
            string qry = "SELECT * FROM Parking WHERE ParkedVehicle = 0;";
            var    cmd = new SqlCommand(qry, conn);

            var reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                var parkItem = new ParkItem(reader);

                // Place item based on Type
                switch (reader["slotType"].ToString())
                {
                case "P":
                    FreeParking.Add(parkItem);
                    break;

                case "D":
                    FreeDocking.Add(parkItem);
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 2
0
        internal static Cell GetCell(int index, CellType cellType)
        {
            Cell cell = null;

            if (cellType == CellType.StartCell)
            {
                cell = new StartCell();
            }
            if (cellType == CellType.PropertyCell)
            {
                cell = new PropertyCell();
            }
            if (cellType == CellType.JailCell)
            {
                cell = new JailCell();
            }
            if (cellType == CellType.GoToJailCell)
            {
                cell = new GoToJailCell();
            }
            if (cellType == CellType.FreeParking)
            {
                cell = new FreeParking();
            }
            cell.Index = index;
            return(cell);
        }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     player_dice     = GameObject.FindObjectOfType <DiceNumberTextScript>();
     fp              = GameObject.FindObjectOfType <FreeParking>();
     cam             = GameObject.FindObjectOfType <CamEvent>();
     TargetPosition  = this.transform.position;
     CurrentPosition = StartPosition;
     isDoneRolling1  = false;
     isDoneRolling2  = false;
     salary          = 1500;
     count           = 1;
     MoveQueueIndex  = 9999;
     float SmoothTime = 0.05f;
 }
    private void FreeParkingTile()
    {
        int pos = listPlayer[idPlayerPlaying].Position;

        FreeParking FP = (FreeParking)plateau.TheBoard[pos];

        if (FP.CashAvailable != 0)
        {
            infosToPlayer += "Free Parking: cash available! You win " + FP.CashAvailable + "€\n";
            listPlayer[idPlayerPlaying].Cash += FP.CashAvailable;
            FP.CashAvailable      = 0;
            plateau.TheBoard[pos] = FP;
        }
        else
        {
            infosToPlayer += "Free parking: no cash available\n";
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Fromat the data list we've created using the CSV file to the Case format
    /// Each of the Tiles are inserted in the board
    /// </summary>
    public void InitiateBoard()
    {
        List <string[]> data = ReadFile();

        theBoard = new Case[40];
        for (int i = 0; i < 40; i++)
        {
            string[] row = data[i];
            if (row[1] == "J") //1 corresponding to column in csv where we can find the type of case
            {
                theBoard[i] = new Jail(Convert.ToInt32(row[0]), row[1], row[2]);
            }
            else if (row[1] == "P")
            {
                int[] prices = { Convert.ToInt32(row[3]), Convert.ToInt32(row[4]), Convert.ToInt32(row[5]), Convert.ToInt32(row[6]), Convert.ToInt32(row[7]), Convert.ToInt32(row[8]), Convert.ToInt32(row[9]), Convert.ToInt32(row[10]) };
                theBoard[i] = new Property(Convert.ToInt32(row[0]), row[1], row[2], prices);
            }
            else if (row[1] == "L")
            {
                theBoard[i] = new Chance(Convert.ToInt32(row[0]), row[1], row[2]);
            }
            else if (row[1] == "E")
            {
                theBoard[i] = new Community(Convert.ToInt32(row[0]), row[1], row[2]);
            }
            else if (row[1] == "G")
            {
                theBoard[i] = new Train(Convert.ToInt32(row[0]), row[1], row[2]);
            }
            else if (row[1] == "C")
            {
                theBoard[i] = new Companies(Convert.ToInt32(row[0]), row[1], row[2]);
            }
            else if (row[1] == "PG")
            {
                theBoard[i] = new FreeParking(Convert.ToInt32(row[0]), row[1], row[2]);
            }
            else
            {
                theBoard[i] = new OtherTiles(Convert.ToInt32(row[0]), row[1], row[2]);
            }
        }
    }
    private void CommunityTile()
    {
        int       pos = listPlayer[idPlayerPlaying].Position;
        Community C   = (Community)plateau.TheBoard[pos];

        int communityMoney = C.WinOrLoose();

        listPlayer[idPlayerPlaying].Cash += communityMoney;
        if (communityMoney < 0) //If the player looses money it goes to the middle and can be won by any player landing on the free parking tile
        {
            FreeParking FP = (FreeParking)plateau.TheBoard[20];
            FP.CashAvailable    += -communityMoney;
            plateau.TheBoard[20] = FP;
            infosToPlayer       += "Community: you loose " + (-communityMoney) + "€\n";
        }
        else
        {
            infosToPlayer += "Community: you loose " + communityMoney + "€\n";
        }
    }