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