private void ManageStates() { //can use var if it's initialized State[] nextStates = state.GetNextStates(); for (int i = 0; i < nextStates.Length; i++) { if (Input.GetKeyDown(KeyCode.Alpha1 + i)) { state = nextStates[i]; } else if (Input.GetKeyDown(KeyCode.Q)) { SceneManager.LoadScene("Start"); } if (state.name.Equals("leave_room") && (!hasSword || !hasArmour)) { state = need_sword_armour; } } //to set the boolean's to true or false - must have sword & armour if (state.name.Equals("store_sword")) { hasSword = true; } else if (state.name.Equals("wear_armour")) { hasArmour = true; } karmaPoints += state.GetKarmaPoints(); //if your karma points go over 20 dragon will kill u :) ... if (karmaPoints >= 20) { canKillDragon = false; } else { canKillDragon = true; } if (state.GetDidLose() || (!canKillDragon && state.name.Contains("ending"))) { LoseGame.GetState(state); SceneManager.LoadScene("Lost"); } else if (canKillDragon && state.name.Contains("ending")) { WinGame.GetState(state); SceneManager.LoadScene("Won"); } else { myText.text = state.GetStateStory(); } }
public void OnWinGame(int playerHealthPoint) { WinGameEventArgs winGame = new WinGameEventArgs { HealthPoint = playerHealthPoint }; WinGame?.Invoke(this, winGame); }
public void Win() { WinGame.Invoke(); if (Input.GetKeyDown(KeyCode.Space)) { StartCoroutine(ChangeToMenu()); } }
private void WinGameCallBack(IExtensible msgData) { WinGame winGame = (WinGame)msgData; Debug.LogError("Win!!!!!!!!!!!!" + winGame.win); if (winGame.win) { Debug.LogError("Win!!!!!!!!!!!!"); } }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } shootBtn = GameObject.Find("ShootButton").GetComponent <Button>(); DownListener.Get(shootBtn.gameObject).onDown = ShootTheNeedle; InitNeedleForCircle(level); failGame += FailedGame; winGame += WinedGame; PlayerPrefs.DeleteKey("level"); level = PlayerPrefs.GetInt("level", 1); needShoot = 6 + level / 2; ScoreText.text = level.ToString(); NeedShootNum.text = needShoot.ToString(); }
void Start() { myParticleSystem = GetComponentInChildren<WinGame>(); }
public static void OnWinGame(int winCount, int coinRewardCount) => WinGame?.Invoke(winCount, coinRewardCount);
void Start() { winGame = GetComponent <WinGame>(); }
private void OnWinGame(EventArgs e) => WinGame?.Invoke(this, e);
private void Awake() { CurrentScreen = this; WinScreen = gameObject; WinScreen.SetActive(false); }
void Start() { levelOfPage = SceneManager.GetActiveScene().name; gmScript = GameObject.FindWithTag("GameMaster").GetComponent <GameMaster>(); winPopupScript = GameObject.Find("WinPopup").GetComponent <WinGame>(); }