public void PlacePenguin() //placement des IAs { Random randX = new Random(); Random randY = new Random(); while (PlayersObject.Count() != 0) { int coordX = randX.Next(1, 8); int coordY = randX.Next(1, 8); Cell tempTab = BoardObject.BoardObject[coordX, coordY]; Penguin tempPenguin = new Penguin(); if (tempTab.fishCount == 1) { tempTab.CurrentPenguinObject = tempPenguin; tempTab.CurrentPenguinObject.PlayerObject = CurrentPlayerObject; tempTab.CellType = CellType.FishWithPenguin; currentPlayerIndex++; CurrentPlayerObject = PlayersObject[currentPlayerIndex]; } else { coordX = 0; coordY = 0; coordX = randX.Next(1, 8); coordY = randX.Next(1, 8); } } if (StateChanged != null) { StateChanged.Invoke(this, null); } }
public void PlacePenguinManual(int x, int y) { //fonction de placement Cell tempTab = BoardObject.BoardObject[x, y]; Penguin tempPenguin = new Penguin(); tempTab.CurrentPenguinObject = tempPenguin; tempTab.CurrentPenguinObject.PlayerObject = CurrentPlayerObject; tempTab.CellType = CellType.FishWithPenguin; currentPlayerIndex++; CurrentPlayerObject = PlayersObject[currentPlayerIndex]; if (StateChanged != null) { StateChanged.Invoke(this, null); } }