Esempio n. 1
0
    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();
        }
    }
Esempio n. 2
0
 void OnDestroy()
 {
     LoseGame.CheckGameOverState();
 }
Esempio n. 3
0
 // Start is called before the first frame update
 void Start()
 {
     wavescrip = gameObject.GetComponent <WaveManager>();
     losegame  = gameObject.GetComponent <LoseGame>();
     money     = gameObject.GetComponent <Money>();
 }
Esempio n. 4
0
 public void OnLoseGame()
 {
     LoseGame?.Invoke();
 }
Esempio n. 5
0
 private void Start()
 {
     _loseGame = FindObjectOfType <LoseGame>();
 }
Esempio n. 6
0
 // Start is called before the first frame update
 void Start()
 {
     cd       = Cooldown * 2;
     pontos   = 0;
     losegame = gameObject.GetComponent <LoseGame>();
 }