Esempio n. 1
0
    private int DropJeton(int player, int column)
    {
        JetonObject jeton = new JetonObject(player);

        if (theCases[column, 0].GetCaseOccupied())
        {
            return(-1);
        }

        for (int line = 1; line < ECHIQUIER_LINES; line++)
        {
            if (theCases[column, line].GetCaseOccupied())
            {
                theCases[column, line - 1].SetCaseJeton(jeton);
                return(line - 1);
            }
        }

        // Last position
        theCases[column, 5].SetCaseJeton(jeton);

        return(5);
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        // Set resolution
        // Switch to 1280 x 720 windowed
        Screen.SetResolution(1280, 720, false);

        // Text
        leText         = titleText.GetComponent <Text>();
        leTextVictoire = vicText.GetComponent <Text>();

        // Button
        nextPlayerButton.SetActive(false);
        gameActive   = true;
        gameFinished = false;

        // Create all the cases
        theCases = new CaseObject[ECHIQUIER_COLUMNS, ECHIQUIER_LINES];

        for (int column = 0; column < ECHIQUIER_COLUMNS; column++)
        {
            for (int line = 0; line < ECHIQUIER_LINES; line++)
            {
                JetonObject   jeton;
                PlatePosition pos;
                pos.x = column;
                pos.y = line;
                jeton = new JetonObject(0);
                theCases[column, line] = new CaseObject(false, jeton, pos);
            }
        }

        // First player 1
        currentPlayer       = 1;
        arrowColumn         = 0;
        leTextVictoire.text = "";
    }
Esempio n. 3
0
 public void SetCaseJeton(JetonObject obj)
 {
     theJeton = obj;
     SetCaseOccupied(true);
 }
Esempio n. 4
0
 //////////////////////////////////////////////////////////////////////////////////
 // Constructor
 //////////////////////////////////////////////////////////////////////////////////
 ///
 public CaseObject(bool bOcc, JetonObject jeton, PlatePosition pos)
 {
     this.bOccupied   = bOcc;
     this.theJeton    = jeton;
     this.thePosition = pos;
 }