private void Init() { int ind = 0; for (int i = 0; i < imgArray.Length * 2; i++) { int temp = i; prefabList.Add(Instantiate(meganPrefab, memoryGridTransform)); prefabList[i].GetComponent <Button>().onClick.AddListener(() => { OnClick(temp); }); //Increases the imgArray index by 1 everytime i can be divided by 2 //Hereby adding the same images 2 times before adding the next image if (i % 2 == 0 && i != 0) { ind++; } answerList.Add(imgArray[ind]); } ShuffleClass.Shuffle(answerList); }
public void StartGame() { ansCount = 0; answersPicked.Clear(); for (int i = 0; i < prefabList.Count; i++) { prefabList[i].GetComponent <RawImage>().texture = meganDefault; prefabList[i].GetComponent <Button>().interactable = true; } ShuffleClass.Shuffle(answerList); }
public void Setup(int k) { dataWriter = new DataWriter(k, rdata); random = new Random(); people = new List <Person>(); SaveData.Susceptible = Globals.totalpopulation; SaveData.Exposed = 0; SaveData.Infectious = 0; SaveData.Recovered = 0; for (int i = 0; i < Globals.totalpopulation; i++) { people.Add(new Person(random.Next(0, Globals.worldsize), random.Next(0, Globals.worldsize), random)); } word = new WorldGrid(Globals.gridsize, Globals.tilesize, people); for (int i = 0; i < Globals.illpopulation; i++) { people[i].HealthStatus = HealthStatus.Infectious; } ShuffleClass.Shuffle(people); for (int i = 0; i < Globals.apppopulation; i++) { people[i].App = new App(); } dataWriter.Write(); step = 0; hours = 0; }
protected override void LoadContent() { base.LoadContent(); IsMouseVisible = true; Screen.Background = Color.Black; Screen.WindowSize = new Point(1600, 900); //dataWriter = new DataWriter(); GameObjectList <GameObject> state = new GameObjectList <GameObject>(); GameObjectList <GameObject> simulatie = new GameObjectList <GameObject>(); people = new List <Person>(); SaveData.Susceptible = Globals.totalpopulation; for (int i = 0; i < Globals.totalpopulation; i++) { DrawablePerson p = new DrawablePerson(random.Next(0, Globals.worldsize), random.Next(0, Globals.worldsize), random); people.Add(p); simulatie.Add((p as DrawablePerson).Visual); } world = new DrawableWorld(Globals.gridsize, Globals.tilesize, people); foreach (DrawableTile t in world.Tiles) { simulatie.Add(t.Visual); } for (int i = 0; i < Globals.illpopulation; i++) { people[i].HealthStatus = HealthStatus.Infectious; } ShuffleClass.Shuffle(people); for (int i = 0; i < Globals.apppopulation; i++) { people[i].App = new App(); } //dataWriter.Write(SaveData.Healthy, SaveData.Ill, SaveData.Recovered); simulatie.Position2 = new Vector2(-500, -500); simulatie.Scale = 1000f / (float)Globals.worldsize; //simulation data frames = new TextGameObject("Hud", 2); frames.TextFont.Text = "start"; frames.Position2 = new Vector2(-960, 500); susceptible = new TextGameObject("Hud", 2); susceptible.TextFont.Text = 0.ToString(); susceptible.Position2 = new Vector2(-960, 450); susceptible.TextFont.Color = new Color(65, 122, 0); exposed = new TextGameObject("Hud", 2); exposed.TextFont.Text = 0.ToString(); exposed.Position2 = new Vector2(-960, 400); exposed.TextFont.Color = new Color(195, 174, 0); infectious = new TextGameObject("Hud", 2); infectious.TextFont.Text = 0.ToString(); infectious.Position2 = new Vector2(-960, 350); infectious.TextFont.Color = new Color(255, 56, 0); recovered = new TextGameObject("Hud", 2); recovered.TextFont.Text = 0.ToString(); recovered.Position2 = new Vector2(-960, 300); recovered.TextFont.Color = new Color(1, 65, 255); step = 0; hours = 0; steps = new TextGameObject("Hud", 2); steps.TextFont.Text = step.ToString(); steps.Position2 = new Vector2(-960, 250); state.Add(frames); state.Add(susceptible); state.Add(exposed); state.Add(infectious); state.Add(recovered); state.Add(steps); state.Add(simulatie); GameStateManager.AddGameState("start", state); GameStateManager.SwitchTo("start"); }