public void RemplissageBoard() { board = new Case[dimX, dimY]; for (int i = 0; i < dimX; i++) { for (int j = 0; j < dimY; j++) { switch (temp[i, j]) { case "0": board[i, j] = caseFactory.returnCase("libre", dimX, dimY, this); break; case "1": board[i, j] = caseFactory.returnCase("mur", dimX, dimY, this); break; case "2": board[i, j] = caseFactory.returnCase("sortie", dimX, dimY, this); break; default: break; } } } }
public override List <Position> GetRayon(Vector3 startPos, Case targetCase, Case[,] grid, int dimX, int dimY) { List <Position> positions = new List <Position>(); List <Case> caseAVisite = new List <Case>(); List <Case> caseDejaVisite = new List <Case>(); Case c; caseAVisite.Add(targetCase); while (caseAVisite.Count > 0) { c = caseAVisite[0]; foreach (Case ca in GetNeighbours(c, dimX, dimY, grid)) { if (!caseDejaVisite.Contains(ca) && GetDistanceDeLaCase(targetCase, ca) <= (rayon - 1) / 2) { positions.Add(new Position(ca.getX(), ca.getY(), GetDistanceDeLaCase(ca, targetCase), null)); caseDejaVisite.Add(ca); caseAVisite.Add(ca); } } caseAVisite.RemoveAt(0); } return(positions); }
private bool AunJumeauColonne(Case[,] TabCarreJumeau, int lig, int col) { int tailleCarré = (int)Math.Sqrt(size); Case[] tabjum = new Case[tailleCarré]; bool CarréEstValide = false; int divC, divL, modC, modL; divC = col / tailleCarré; modC = col % tailleCarré; divL = lig / tailleCarré; modL = lig % tailleCarré; int compte = 0; for (int i = 0; i < tailleCarré; i++) { if (TabCarreJumeau[i, modC].NbHypothese == 2) { tabjum[compte] = TabCarreJumeau[i, modC]; compte++; } } if (compte == 2) { TabCaseJum = tabjum; CarréEstValide = true; } return(CarréEstValide); }
public EchecThreat PieceEchec(Case [,] board, ChessMan Target, ChessMan deleted = null) { if (Target == null) { return(null); } EchecThreat threat = new EchecThreat(Target); foreach (ChessMan chess in m_sCase.Pieces) { if (deleted != null && deleted == chess) { continue; } if (chess.color != Target.color) { List <Case> moves = chess.GetPossibleMovement(board, false); foreach (Case c in moves) { //here it means if we have a possible movement case non null with the ennemy king on it if (c.currPiece != null && c.currPiece == Target) { threat.Add(chess); } } } } threat.SortThreats(); return(threat.threater.Count > 0 ? threat : null); }
public List <Case> GetNeighbours(Case c, int dimX, int dimY, Case[,] grid) { List <Case> neighbours = new List <Case>(); for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { if (x == 0 && y == 0) { continue; } int checkX = c.getX() + x; int checkY = c.getY() + y; if (checkX >= 0 && checkX < dimX && checkY >= 0 && checkY < dimY) { neighbours.Add(grid[checkY, checkX]); } } } return(neighbours); }
public Map(List <int[]> list) { box = new Case[5, 5]; box[0, 0] = new Case(new Gamorra()); box[0, 1] = new Case(new Warrior()); box[0, 2] = new Case(new Heal()); box[0, 3] = new Case(new CaptainAmerica()); box[0, 4] = new Case(new Vision()); box[1, 0] = new Case(new StarLord()); box[1, 1] = new Case(new Booster()); box[1, 2] = new Case(new Witch()); box[1, 3] = new Case(new ScarletWitch()); box[1, 4] = new Case(new Attack()); box[2, 0] = new Case(new Witch()); box[2, 1] = new Case(new Heal()); box[2, 2] = new Case(new Witch()); box[2, 3] = new Case(new Booster()); box[2, 4] = new Case(new Witch()); box[3, 0] = new Case(new Warrior()); box[3, 1] = new Case(new Attack()); box[3, 2] = new Case(new Warrior()); box[3, 3] = new Case(new Heal()); box[3, 4] = new Case(new SpiderMan()); box[4, 0] = new Case(new Hulk()); box[4, 1] = new Case(new Booster()); box[4, 2] = new Case(new Warrior()); box[4, 3] = new Case(new IronMan()); box[4, 4] = new Case(new DoctorStrange()); for (int i = 0; i < list.Count; i++) { box[list[i][0], list[i][1]].visited = true; } }
private void Form1_Load(object sender, EventArgs e) { #region Documentation // Initialiser nos champs qui seront : // la grille de cases, le répertoire courant, l'état de l'appli. // On devrait affiche une grille par défaut. // On appellerait une méthode pour ce faire. // Désactiver le bouton sauvegarder. // Passer en mode Jeu #endregion Documentation #region Code // Initialiser nos champs historique = new List <CaseInfo>(); grille = new Case[9, 9]; CreerGrille(); // par défaut, "" représente le répertoire bin du projet. // Mais, au fur et à mesure de l'exécution, celui-ci pourrait changer. // On le conserve donc dans currentDir. currentDir = Environment.CurrentDirectory; // Charger des valeurs dans la grille // Ici, on pourrait allouer une grille par défaut. // On appelle donc une méthode pour ce faire. GrilleParDefaut(); enJeu = true; #endregion Code }
public void LoadFromFile(string path) { List <STATE[]> states = new List <STATE[]>(); StreamReader read = new StreamReader(path); int i = 0; while (!read.EndOfStream) { string[] currentLine = read.ReadLine().Split(','); states.Add(new STATE[currentLine.Length]); for (int j = 0; j < currentLine.Length; j++) { states[i][j] = (STATE)int.Parse(currentLine[j]); } i++; } NbColumn = states[0].Length; NbLine = i; Grid = new Case[NbColumn, NbLine]; for (int j = 0; j < NbColumn; j++) { for (int k = 0; k < NbLine; k++) { Grid[j, k] = new Case(); Grid[j, k].PosGrid.line = k; Grid[j, k].PosGrid.column = j; Grid[j, k].state = states[k][j]; Grid[j, k].ia = null; } } }
private void tsNew_Click(object sender, EventArgs e) { #region Notes et pseudocode // S'occuper des champs globaux du formulaire // Si la grille courante a changé, sauvegarder? // Supprimer l'ancienne grille. // Obtenir la dimension de la nouvelle grille // Créer une grille NxN // NOTE : lorsque je crée ou supprime une grille, je // dois m'occuper des annotations. #endregion #region CODE if (hasChanged) { switch (MessageBox.Show("Enregistrer la grille", "La grille a changé", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { case DialogResult.Yes: tsSave_Click(sender, e); break; case DialogResult.No: break; } } foreach (Case c in grille) { c.Visible = false; // effacer c.Parent = null; // sera récupérée par le GC } // Pour obtenir la dimension de la nouvelle grille, il nous faudra un autre // formulaire. Form2 f = new Form2(); f.ShowDialog(); N = f.N; grille = new Case[N, N]; for (int row = 0; row < N; row++) { for (int col = 0; col < N; col++) { grille[row, col] = new Case(col * 42 + 2, row * 42 + 2, row, col, panel, false, Case_Click); Case b = grille[row, col]; b.Parent = panel; // placer le bouton sur la grille b.SetValue(" "); } } // Annotations ??? // Afficher et maj les annotations // Ajuster les dimensions du Panel panel.Width = panel.Height = N * 42 + 6; // Ajuster les dimensions de la fiche Width = panel.Width + 200; Height = panel.Height + 200; hasChanged = false; etat = Etat.Création; historique.Clear(); elapsed = 0; #endregion }
public Echiquier(Partie partie) { this.partie = partie; cases = new Case[8, 8]; int i = 0; // 64 cases (alternance case blanche et noire) for (int x = 0; x < 8; x++) { for (int y = 0; y < 8; y++) { if (i++ % 2 == 0) { cases[x, y] = new Case(this, x, y, CouleurCamp.Blanche); } else { cases[x, y] = new Case(this, x, y, CouleurCamp.Noire); } // Actualisation des cases pour vider l'échiquier en début de partie partie.vue.ActualiserCase(x, y, null); } } }
private void Form1_Load(object sender, EventArgs e) { #region Notes et pseudocode // S'occuper des champs globaux du formulaire // hasChanged, etat, grille, N, historique, N01V, N01H et elapsed. // Désactiver Cancel Enregistrer // Initialiser le timer // Initialiser la barre de status // Afficher une grille par défaut #endregion Notes et pseudocode #region CODE hasChanged = false; MenuAnnuler.Enabled = false; elapsed = 0; grille = null; annotationVertical = annotationHorizontal = null; historique = new List <Contenu>(); AfficherGrilleParDefaut(); #endregion CODE }
public void SetList(Case [,] board) { foreach (Case c in board) { if (c.currPiece != null) { if (c.currPiece.KeyChess) { if (c.currPiece.color) { BlackKing = c.currPiece; } else { WhiteKing = c.currPiece; } } else { Pieces.Add(c.currPiece); } } } Pieces.Add(BlackKing); Pieces.Add(WhiteKing); }
public virtual IEnumerator DoMovement(Case [,] board, int x, int y) { Case selected = board[position.x, position.y]; selected.currPiece = null; float t = 0.0f; while (t < 1.0f) { obj.transform.position = Vector3.Lerp(obj.transform.position, new Vector3(board[x, y].thisCase.transform.position.x, obj.transform.position.y, board[x, y].thisCase.transform.position.z), t); t += Time.deltaTime; if (t > 0.3f) { if (board[x, y].currPiece != null) { StaticClass.m_sCase.Pieces.Remove(board[x, y].currPiece); MonoBehaviour.Destroy(board[x, y].currPiece.obj); } } yield return(null); } board[x, y].currPiece = this; position.x = x; position.y = y; }
public override List <Position> GetRayon(Vector3 startPos, Case targetCase, Case[,] grid, int dimX, int dimY) { List <Position> positions = new List <Position>(); positions.Add(new Position(targetCase.getX(), targetCase.getY(), 0, null)); return(positions); }
/// <summary> /// Initialise une nouvelle instance de la classe Sudoku /// </summary> /// <param name="sudokuGrid">tableau de Case représentant la grille partiellement remplie</param> /// <param name="sudokuSol">tableau de Case représentant la solution de la grille</param> /// <param name="n">le type de grille, n = 3 donne une grille de (9 x 9)</param> public Sudoku(Case[,] sudokuGrid, Case[,] sudokuSol, uint n) { _sudokuGrid = sudokuGrid; _sudokuSol = sudokuSol; _n = n; _size = (n * n); }
public EchecThreat PieceEchec(Case [,] board, Simulation sim, ChessMan Target, bool OneShotSimulation = false) { sim.Simulate(); EchecThreat threat = new EchecThreat(sim.targetCase.currPiece); foreach (ChessMan chess in m_sCase.Pieces) { if (sim.deletedBackup != null && sim.deletedBackup == chess) { continue; } if (chess.color != Target.color) { List <Case> moves = chess.GetPossibleMovement(board, false); foreach (Case c in moves) { //here it means if we have a possible movement case non null with the target on it if (c.currPiece != null && c.currPiece == Target) { threat.Add(chess); } } } } threat.SortThreats(); if (OneShotSimulation) { sim.Delete(); } return(threat.threater.Count > 0 ? threat : null); }
public override bool IsValidMouvement(ref Case[,] plateau, Point destination, Point currentPosition) { if (plateau[destination.Y, destination.X].UnePiece == null || plateau[destination.Y, destination.X].UnePiece.Couleur != this.Couleur) { if (destination.Y == currentPosition.Y - 1) { if (CheckLigne(destination, currentPosition)) { return(true); } } else if (destination.Y == currentPosition.Y) { if (destination.X == currentPosition.X - 1 || destination.X == currentPosition.X + 1) { return(true); } } else if (destination.Y == currentPosition.Y + 1) { if (CheckLigne(destination, currentPosition)) { return(true); } } } return(false); }
public Map() { box = new Case[5, 5]; box[0, 0] = new Case(new Gamorra()); box[0, 1] = new Case(new Warrior()); box[0, 2] = new Case(new Heal()); box[0, 3] = new Case(new CaptainAmerica()); box[0, 4] = new Case(new Vision()); box[1, 0] = new Case(new StarLord()); box[1, 1] = new Case(new Booster()); box[1, 2] = new Case(new Witch()); box[1, 3] = new Case(new ScarletWitch()); box[1, 4] = new Case(new Attack()); box[2, 0] = new Case(new Witch()); box[2, 1] = new Case(new Heal()); box[2, 2] = new Case(new Witch()); box[2, 3] = new Case(new Booster()); box[2, 4] = new Case(new Witch()); box[3, 0] = new Case(new Warrior()); box[3, 1] = new Case(new Attack()); box[3, 2] = new Case(new Warrior()); box[3, 3] = new Case(new Heal()); box[3, 4] = new Case(new SpiderMan()); box[4, 0] = new Case(new Hulk()); box[4, 1] = new Case(new Booster()); box[4, 2] = new Case(new Warrior()); box[4, 3] = new Case(new IronMan()); box[4, 4] = new Case(new DoctorStrange()); }
//Constructor public Scene(string _name, int _weight, int _height, string _gamemode, int _darkness, List <LayerImage> _adds0, List <LayerImage> _adds1, List <LayerImage> _adds2, List <LayerImage> _walls, List <Case> _cases, List <LayerScript> _scripts, List <Entity> _entities) { name = _name; weight = _weight; height = _height; gamemode = _gamemode; darkness = _darkness; adds0 = _adds0; adds1 = _adds1; adds2 = _adds2; walls = _walls; cases = new Case[weight, height]; for (int i = 0; i < weight; ++i) { for (int j = 0; j < height; ++j) { cases[i, j] = new Case(i, j); } } foreach (Case c in _cases) { cases[c.x, c.y] = c; } foreach (LayerImage add1 in adds1) { for (int i = add1.x; i < add1.x; ++i) { for (int j = add1.y; j < add1.y; ++j) { cases[i, j].type = add1.high < 100 ? "add1" : "wall"; cases[i, j].high = add1.high; } } } foreach (LayerImage wall in walls) { for (int i = wall.x; i < wall.x + wall.weight; ++i) { for (int j = wall.y; j < wall.y + wall.height; ++j) { cases[i, j].type = "wall"; cases[i, j].high = 100; } } } scripts = _scripts; entities = _entities; foreach (Entity entity in entities) { for (int i = entity.x; i < entity.x; ++i) { for (int j = entity.y; j < entity.y; ++j) { cases[i, j].type = entity.type; } } } }
public void reset() { foreach (Transform obj in transform) { GameObject.Destroy(obj.gameObject); } grid = null; }
public Board(int x, int y) { gameboard = new Case[x, y]; for (int i = 0; i < x; i++) for (int j = 0; j < y; j++) gameboard[i, j] = new Case(i, j); noPlaceLeft = x * y; }
/***************************************/ public Matrice(int nbLines, int nbColumns, double coordX, double coordY) //Constructeur de la matrice { nbLignes = nbLines; //Initialisation du nombre de lignes et de colonnes, et des coordonnées nbColonnes = nbColumns; this.coordX = coordX; this.coordY = coordY; this.tab = new Case[nbLines, nbColumns]; }
void Start() { instance = this; lastUpdate = Main.time(); size = 0; grid = new Case[0, 0]; diversite = 0; }
public Map(int largeur, int longueur) { Largeur = largeur; Longueur = longueur; Plateau = new Case[largeur, longueur]; Position = new Case[largeur, longueur]; truc(); }
public override List <Position> GetRayon(Vector3 startPos, Case targetCase, Case[,] grid, int dimX, int dimY) { int direction = getDirection(startPos, targetCase); int xUtilisable = (x - 1) / 2; int yUtilisable = (y - 1) / 2; if (direction == 0) { if (x > y) { xUtilisable = (y - 1) / 2; yUtilisable = (y - 1) / 2; } else { xUtilisable = (x - 1) / 2; yUtilisable = (x - 1) / 2; } } else if (direction == 2) { xUtilisable = (y - 1) / 2; yUtilisable = (x - 1) / 2; } List <Position> positions = new List <Position>(); int debutx = targetCase.getX() - xUtilisable; int finx = targetCase.getX() + xUtilisable; int debuty = targetCase.getY() - yUtilisable; int finy = targetCase.getY() + yUtilisable; if (targetCase.getX() - xUtilisable < 0) { debutx = 0; } if (targetCase.getY() - yUtilisable < 0) { debuty = 0; } if (targetCase.getX() + xUtilisable >= dimX) { finx = dimX - 1; } if (targetCase.getY() + yUtilisable >= dimY) { finy = dimY - 1; } int debutyInitial = debuty; for (; debutx <= finx; debutx++) { for (debuty = debutyInitial; debuty <= finy; debuty++) { positions.Add(new Position(grid[debuty, debutx].getX(), grid[debuty, debutx].getY(), GetDistanceDeLaCase(grid[debuty, debutx], targetCase), null)); } } return(positions); }
// Use this for initialization void Awake() { plateau = new Case[Constantes.taillePlateauX, Constantes.taillePlateauY]; // !!! //personnageTour = GameObject.Find("PersonnageMage(Clone)").GetComponent<Personnage>(); affichageTextPv = GameObject.Find("Pv").GetComponent <Text>(); barreDeVie = GameObject.Find("BarreDeVie").GetComponent <Image>(); tourActuel = 1; textTourActuel = GameObject.Find("TextTour").GetComponent <Text>(); textTourActuel.text = "" + 1; teamA = new List <Personnage>(); teamB = new List <Personnage>(); personnages = new List <Personnage>(); // !!! /* if (PhotonNetwork.isMasterClient) * {*/ /*print(GameObject.FindGameObjectsWithTag("Personnage").Length); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[0] + "(Clone)").GetComponent<Personnage>()); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[1] + "(Clone)").GetComponent<Personnage>()); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[2] + "(Clone)").GetComponent<Personnage>()); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[3] + "(Clone)").GetComponent<Personnage>());*/ /* } * else * { * print(SceneConstant.teamJoueur[2]); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[2] + "(Clone)").GetComponent<Personnage>()); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[3] + "(Clone)").GetComponent<Personnage>()); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[0] + "(Clone)").GetComponent<Personnage>()); * personnages.Add(GameObject.Find(SceneConstant.teamJoueur[1] + "(Clone)").GetComponent<Personnage>()); * }*/ /*teamA.Add(personnages[0]); * teamA.Add(personnages[1]); * teamB.Add(personnages[2]); * teamB.Add(personnages[3]); * personnageTour = personnages[0];*/ /*teamB.Add(GameObject.Find("PersonnageGuerrier(Clone)").GetComponent<Guerrier>()); * teamA.Add(GameObject.Find("PersonnageAssassin(Clone)").GetComponent<Assassin>()); * teamB.Add(GameObject.Find("PersonnageArbaletrier(Clone)").GetComponent<Arbaletrier>());*/ /*personnages.Add(teamA[0]); * personnages.Add(teamB[0]); * personnages.Add(teamA[1]); * personnages.Add(teamB[1]);*/ /*for (int i = personnages.Count - 1; i >= 0; i--) * { * personnages[i].textPv = GameObject.Find("PV" + (i + 1)).GetComponent<Text>(); * personnages[i].textPv.gameObject.SetActive(false); * personnages[i].SpriteTimeLine = Instantiate(personnages[i].sprites[1], new Vector3(8.25f - (personnages.Count - 1 - i), -4.25f, 0), Quaternion.identity); * personnages[i].SpriteTimeLine.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0.5f); * }*/ }
public override List <Case> FindPath(Vector3 startPos, Vector3 targetPos, Case[,] grid, int dimX, int dimY) { Case startNode = grid[Mathf.RoundToInt(-startPos.y), Mathf.RoundToInt(startPos.x)]; Case targetNode = grid[Mathf.RoundToInt(-targetPos.y), Mathf.RoundToInt(targetPos.x)]; startNode.precedent = null; startNode.perso = null; List <Case> openSet = new List <Case>(); HashSet <Case> closedSet = new HashSet <Case>(); openSet.Add(startNode); while (openSet.Count > 0) { Case node = openSet[0]; for (int i = 1; i < openSet.Count; i++) { if (openSet[i].fCost < node.fCost || openSet[i].fCost == node.fCost) { if (openSet[i].hCost < node.hCost) { node = openSet[i]; } } } openSet.Remove(node); closedSet.Add(node); if (node == targetNode) { return(RetracePath(startNode, targetNode)); } foreach (Case neighbour in GetNeighbours(grid, node, dimX, dimY)) { if (neighbour.mur || (neighbour.perso != null && neighbour != targetNode) || closedSet.Contains(neighbour)) { continue; } int newCostToNeighbour = node.gCost + GetDistance(node, neighbour); if (newCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour)) { neighbour.gCost = newCostToNeighbour; neighbour.hCost = GetDistance(neighbour, targetNode); neighbour.precedent = node; if (!openSet.Contains(neighbour)) { openSet.Add(neighbour); } } } } return(null); }
public Case(int x, int y, Case[,] board, GameObject prefab, bool color) { col = color; mat = col == true ? StaticClass.m_sTools.blackCase : StaticClass.m_sTools.whiteCase; position = new Vector2i(x - StaticClass.m_sCase.setupBoard.Border, y - StaticClass.m_sCase.setupBoard.Border); thisCase = (GameObject)MonoBehaviour.Instantiate(prefab, new Vector3(x, 0, y), Quaternion.identity); thisCase.name = "case : " + x + " : " + y; thisCase.GetComponent <Renderer>().material = mat; }
public Plateau(Partie partie, int largeur, int hauteur, int mines) { this.partie = partie; this.largeur = largeur; this.hauteur = hauteur; this.mines = mines; this.restantes = mines; this.mineAPlacer = mines; cases = new Case[largeur, hauteur]; //Initialise les cases du plateau for (int y = 0; y < hauteur; y++) { for (int x = 0; x < largeur; x++) { bool isMine = false; int test = des.Next(0, (hauteur * largeur) - ((y * largeur) + x)); if (test < mineAPlacer) { isMine = true; mineAPlacer--; } cases[x, y] = new Case(this, x, y, isMine); //Faire en sorte de minée aléatoirement } } //Créé les liaisons for (int y = 0; y < hauteur; y++) { for (int x = 0; x < largeur; x++) { // connection avec les voisines int N = hauteur - 1; if (x > 0 && y > 0) { Connecter(cases[x, y], cases[x - 1, y - 1]); } if (x > 0) { Connecter(cases[x, y], cases[x - 1, y]); } if (y > 0) { Connecter(cases[x, y], cases[x, y - 1]); } if (x > 0 && y < N) { Connecter(cases[x, y], cases[x - 1, y + 1]); } } } }
//新的棋盘 private void InitTable(Case[, ] table, int lins, int cols) { for (int i = 0; i < lins; i++) { for (int j = 0; j < cols; j++) { table[i, j] = Case.Void; } } }
//public PositionP4(bool j1aletrait, Case[, ] table, int nbCoups, ArrayList possibleCoup, ArrayList nextXPosition) : this(j1aletrait) //调用上面的PositionA(bool j1aletrait) //{ // this.table = table; // this.possibleCoup = possibleCoup; // this.nextXPosition = nextXPosition; // this.NbCoups = nbCoups; //} public PositionP4(bool j1aletrait, int lins, int cols) : this(j1aletrait) //调用上面的PositionA(bool j1aletrait) { this.NbCoups = cols; //总共可以行动的次数,起始是 1 2 3 4 5 6 this.lins = lins; this.cols = cols; this.table = new Case[lins, cols]; InitTable(this.table, lins, cols); this.possibleCoup = NewPossibleCoup(cols); this.nextXPosition = NewnextXPosition(lins, cols); }
public Grille(string nom,string date,string symbole,char[,] tab) { Nom = nom; Date = date; Symbole = symbole; TabGrille = tab; tabCase = new Case[size, size]; tabCaseJum = new Case[2]; CréerLesCases(TabGrille); // à traiter }
public void initGrid( int width, int height ) { this.width = width; this.height = height; grid = new Case[ width, height ]; for ( int x = 0; x < width; x ++ ) for ( int y = 0; y < height; y ++ ) grid[ x, y ] = new Case( x, y ); }
/// <summary> /// Creates a new map with the given cases array. /// </summary> /// <param name="cases">2D array of cases.</param> public Map(Case[,] cases) { this.cases = cases; startingPositions = new Stack<Case>(); // Initialize the player positions (up to 4 players) at the corners of the map. startingPositions.Push(RandomCase(cases[0, 0], 5)); startingPositions.Push(RandomCase(cases[Size - 1, Size - 1], 5)); startingPositions.Push(RandomCase(cases[Size - 1, 0], 5)); startingPositions.Push(RandomCase(cases[0, Size - 1], 5)); }
public Plateau(int[] parametres, Grid _inGPlateau) { _matrice = new Case[parametres[1], parametres[0]]; _nbRow = parametres[1]; _nbColumn = parametres[0]; for (int i = 0; i < _nbRow; i++) for (int j = 0; j < _nbColumn; j++) _matrice[i, j] = new Case(i, j); _acteurs = new List<Entite>(); _listGrp = new List<Groupe>(); _gPlateau = _inGPlateau; InitActeurs(parametres); }
public Plateau() { rectangleSelection = new Selection(); plateauRectangle = new Rectangle(0, 0, 352, 352); plateauValeur = new Case[8, 8]; positionPossibilities = new List<Point>(); playerTour = PlayerColor.White; pieceIsSelected = false; isEchec = false; isEchecEtMat = false; CaseHeight = 44; CaseWidth = 44; }
public Game( int width, int height ) { radius = new Radius( this ); plans = new Plans( this ); frontier = new Frontier( this ); this.width = width; this.height = height; grid = new Case[ width, height ]; for ( int x = 0; x < width; x ++ ) for ( int y = 0; y < height; y ++ ) grid[ x, y ] = new Case( x, y ); }
public Carte(Vector2 size) { _case = new Case[(int)size.Y, (int)size.X]; origineJoueur1 = -Vector2.One; origineJoueur2 = -Vector2.One; positionTemporaire = Vector2.Zero; _originesGarde = new List<Vector2>(); _originesPatrouilleur = new List<List<Vector2>>(); _originesPatrouilleur_a_cheval = new List<List<Vector2>>(); _origineDark_Hero = -Vector2.One; _originesBoss = new List<Vector2>(); _originesStatues = new List<Vector2>(); rotationsDesStatues = new List<byte>(); bonus = new List<Bonus>(); interrupteurs = new List<Interrupteur>(); munitions = new int[8]; }
public Grille(NumJoueur _num) { IdJoueur = _num; grille = new Case[12, 12]; // une grille est un tableau de cases int x = 0, y = 0; foreach (Case cellule in grille) // On initialise chaque case de la grille { grille.SetValue(new Case(x, y), x, y); x += 1; if (x == 12) { x = 0; y += 1; } } }
bool matchNul; // True en cas de match nul #endregion Fields #region Constructors // Construit le plateau public MyPlateau(Joueur joueur1, Joueur joueur2) { //nbLignes = 6; //nbColonnes = 7; // Crée un tableau de 6 lignes, 7 colonnes lesCases = new Case[nbLignes, nbColonnes]; // Alloue le tableau for (int i = 0; i < nbLignes; i++) for (int j = 0; j < nbColonnes; j++) lesCases[i, j] = new Case(); // Initialise les joueurs this.joueur1 = joueur1; this.joueur2 = joueur2; etatPlateau = Etat.NonCommence; matchNul = false; }
// Constructeur par défaut public Jeu() { // Initialisation des variables resetEvent = new ManualResetEvent(true); randNum = new Random(); plateau = new Case[NB_CASE_HAUTEUR, NB_CASE_LARGEUR]; estPerdu = false; waveOutDevice = new WaveOut(); audioFileReader = new AudioFileReader("Musiques/Tetris.mp3"); LoopStream loop = new LoopStream(audioFileReader); waveOutDevice.Init(loop); waveOutDevice.Play(); for (int i = 0; i < NB_CASE_HAUTEUR; i++) { for (int j = 0; j < NB_CASE_LARGEUR; j++) { plateau[j, i] = new Case(j, i); } } pieceCourante = pieceSuivante(); // On récupére la pièce suivante pieceApres = pieceSuivante(); // Déclaration de l'évenement }
public CarteEcran(int tailleX, int tailleY) { this.iNombreCasesX = tailleX; this.iNombreCasesY = tailleY; this.cases_contenues = new Case[this.iNombreCasesX,this.iNombreCasesY]; }
// constructeur du labyrinth public Maze(uint width, uint heigth) { this.heigth = heigth; this.width = width; maze = new Case[this.width,this.heigth]; exportetab = new float[this.width,this.heigth]; for (int i = 0; i < width; i++) { for (int j = 0; j < heigth; j++) { maze[i, j] = new Case(); exportetab[i, j] = new float(); } } testaffiche = new string[2,2,2,2]; testaffiche[1, 1, 1, 1] = "┼"; testaffiche[1, 1, 1, 0] = "┤"; testaffiche[1, 1, 0, 1] = "├"; testaffiche[1, 0, 1, 1] = "┴"; testaffiche[0, 1, 1, 1] = "┬"; testaffiche[0, 1, 1, 0] = "┐"; testaffiche[1, 0, 1, 0] = "┘"; testaffiche[0, 1, 0, 1] = "┌"; testaffiche[1, 0, 0, 1] = "└"; testaffiche[1, 1, 0, 0] = "|"; testaffiche[0, 0, 1, 1] = "─"; testaffiche[0, 0, 0, 1] = "←"; testaffiche[0, 0, 1, 0] = "→"; testaffiche[0, 1, 0, 0] = "↑"; testaffiche[1, 0, 0, 0] = "↓"; testaffiche[0, 0, 0, 0] = "0"; }
public void init(int x, int y) { terrain = new Case[x,y]; }