public void StartGame(int difficulty, GameEndCallback callback) { FocusMe(); this.callback = callback; isGameRunning = true; spawnedNotes = new List <Note>(4); errorCount = 0; noteCount = 0; spawnNotes = true; root.SetActive(true); WorldTime.Pause(); if (difficulty == 1) { currentGameDiff = easy; } else if (difficulty == 2) { currentGameDiff = medium; } else { currentGameDiff = hard; } SpawnNote(currentGameDiff); timeTillNextNote = currentGameDiff.GetSpawnIntervall(); UpdateErrorCountText(); }
public override void OnGainFocus() { WorldTime.Pause(); invWindow.SetActive(true); float lastY = -5; foreach (var s in collectedItems) { GameObject clone = Instantiate <GameObject>(itemText, itemTextRoot); var item = ItemHolder.GetItem(s.itemID); var compHolder = clone.GetComponent <ItemEntry>(); compHolder.useButton.gameObject.SetActive(item.IsUsable() && item != weapon); compHolder.buttonText.text = item.GetUseButtonText(); compHolder.useButton.onClick.AddListener(() => { item.Use(this); ToogleInv(); ToogleInv(); }); compHolder.itemName.text = item.name + " x" + s.itemAmount; Vector3 lp = clone.transform.localPosition; lp.y = lastY; clone.transform.localPosition = lp; lastY -= 20; } isWindowOpen = true; lastY = -5; foreach (var r in recepts) { if (!r.Craftable(this)) { continue; } GameObject clone = Instantiate <GameObject>(craftButton, craftTextRoot); clone.GetComponentInChildren <UnityEngine.UI.Text>().text = r.ToString(); clone.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => { r.Craft(this); }); Vector3 lp = clone.transform.localPosition; lp.y = lastY; clone.transform.localPosition = lp; lastY -= 30; } }