private Sprite[] RandomLoco() { int x = 0, y = 0; Main.TabImage tab = Main.Global.TabL; while (tab.getImageind(x).Sprite.Equals(tab.getImageind(y).Sprite)) { x = Random.Range(0, (tab.Taille - 1)); y = Random.Range(0, (tab.Taille - 1)); } Main.Image[] locomotions = new Main.Image[2]; locomotions[0] = tab.getImageind(x); locomotions[1] = tab.getImageind(y); Main.Global.TabL.removeImage(locomotions[0]); Main.Global.TabL.removeImage(locomotions[1]); Sprite[] loco = new Sprite[2]; for (int i = 0; i < locomotions.Length; i++) { loco[i] = locomotions[i].Sprite; } return(loco); }
////les 4 fonctions suivantes permettent de générer et stocker les cartes qui seront ensuite ////distribuées aux joueurs. private Sprite[] RandomDim() { int x = 0, y = 0; Main.TabImage tab = Main.Global.TabD; while (tab.getImageind(x).Sprite.Equals(tab.getImageind(y).Sprite)) { x = Random.Range(0, tab.Taille); y = Random.Range(0, tab.Taille); } Main.Image[] dimensions = new Main.Image[2]; dimensions[0] = tab.getImageind(x); dimensions[1] = tab.getImageind(y); Main.Global.TabD.removeImage(dimensions[0]); Main.Global.TabD.removeImage(dimensions[1]); Sprite[] dim = new Sprite[dimensions.Length]; for (int i = 0; i < dimensions.Length; i++) { dim[i] = dimensions[i].Sprite; } return(dim); }
public void OnPointerClick(PointerEventData eventData) { if (pics == images[1]) { pics = images[0]; } else { pics = images[1]; } ShowRandomImage(); }
private Sprite[] RandomPerso() { Main.TabImage tab = Main.Global.TabP; int[] indices = { 0, 0, 0, 0, 0, 0 }; bool allDiff = false; while (!allDiff) { for (int i = 0; i < indices.Length; i++) { indices[i] = Random.Range(0, tab.Taille - 1); } allDiff = true; for (int i = 0; i < indices.Length - 1; i++) { for (int j = i + 1; j < indices.Length; j++) { if (tab.getImageind(indices[i]).Sprite.Equals(tab.getImageind(indices[j]).Sprite)) { allDiff = false; } } } } Main.Image[] personnages = new Main.Image[6]; for (int i = 0; i < personnages.Length; i++) { personnages[i] = tab.getImageind(indices[i]); } for (int i = 0; i < personnages.Length; i++) { Main.Global.TabP.removeImage(personnages[i]); } Sprite[] persos = new Sprite[personnages.Length]; for (int i = 0; i < personnages.Length; i++) { persos[i] = personnages[i].Sprite; } return(persos); }
private Sprite[] RandomEqui() { Main.TabImage tab = Main.Global.TabE; int[] indices = { 0, 0, 0, 0, 0, 0 }; bool allDiff = false; while (!allDiff) { for (int i = 0; i < 6; i++) { indices[i] = Random.Range(0, tab.Taille - 1); } allDiff = true; for (int i = 0; i < indices.Length - 1; i++) { for (int j = i + 1; j < indices.Length; j++) { if (tab.getImageind(indices[i]).Sprite.Equals(tab.getImageind(indices[j]).Sprite)) { allDiff = false; } } } } Main.Image[] equipements = new Main.Image[6]; for (int i = 0; i < equipements.Length; i++) { equipements[i] = tab.getImageind(indices[i]); } for (int i = 0; i < equipements.Length; i++) { Main.Global.TabE.removeImage(equipements[i]); } Sprite[] equi = new Sprite[6]; for (int i = 0; i < equipements.Length; i++) { equi[i] = equipements[i].Sprite; } return(equi); }
// Start is called before the first frame update void Start() { Main.TabImage tab = Main.Global.TabE; int x; int y; x = Random.Range(1, tab.getTaille()); y = Random.Range(1, tab.getTaille()); while (x == y) { y = Random.Range(1, tab.getTaille()); } images = new Main.Image[2]; images[0] = tab.getImageind(x); images[1] = tab.getImageind(y); pics = images[0]; p = Main.Global.Player; ShowRandomImage(); }