public Combattant(bool offensif, int x, int y, Labyrinthe lab) { boardVisite = new bool[x, y]; initBoardVisites(x, y, lab); pointsDeVie = 100; capacite = 10; this.offensif = offensif; //defensif this.objetFactory = new ObjetFactory(); objet = objetFactory.renvoieObjet(); objet.Valeur = 0; stack = new Stack <int[]>(); }
public void initBoardVisites(int x, int y, Labyrinthe lab) { for (int i = 0; i < boardVisite.GetLength(0); i++) { for (int j = 0; j < boardVisite.GetLength(1); j++) { if (lab.Board[i, j] is Mur) { boardVisite[i, j] = true; } else { boardVisite[i, j] = false; } } } }
public Combattant returnCombattant(int x, int y, Labyrinthe lab) { Random random = new Random(); int r = random.Next(0, 2); //offensif if (r == 1) { return(new Combattant(true, x, y, lab)); } //defensif (r == 0) else { return(new Combattant(false, x, y, lab)); } }
public GameManager() { delay = 500; labyrinthe = new Labyrinthe(); listeCombattants = new List <OtherCase>(); listeObjets = new List <OtherCase>(); combattantFactory = new CombattantFactory(); caseFactory = new CaseFactory(); random = new Random(); threadAffichage = new Thread(() => labyrinthe.displayBoard(delay, true)); entierBloque = 0; directionBloque = false; InitBoard(); threadViesCombattant = new Thread(() => VieCombattants(listeCombattants)); /* * //create thread for each combattant * threadCombattant = new Thread[listeCombattants.Count]; * * * for(int i = 0; i != threadCombattant.Length; i++) * { * threadCombattant[i] = new Thread(new ThreadStart(()=>initCombattantListVisitesAndQueue(listeCombattants[i]))); * threadCombattant[i].Start(); * } */ Console.WriteLine("Appuyer pour jouer"); Console.ReadLine(); Console.Clear(); threadAffichage.Start(); Thread threadAffichageStack = new Thread(AjouterStackActionList); threadAffichageStack.Start(); Thread t1 = new Thread(() => FunctionCombattant(listeCombattants[0])); Thread t2 = new Thread(() => FunctionCombattant(listeCombattants[1])); t1.Start(); t2.Start(); }
public Case returnCase(string type, int x, int y, Labyrinthe labyrinthe) { if (type is "mur") { return(new Mur(false, "█")); } else if (type is "sortie") { return(new Sortie(false, " ")); } else if (type is "libre") { return(new OtherCase(true, " ", null)); } else if (type == "objet") { return(new OtherCase(false, "$", objetFactory.renvoieObjet())); } else { return(new OtherCase(false, "O", combattantFactory.returnCombattant(x, y, labyrinthe))); } }