Inheritance: MonoBehaviour
    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);
    }
Exemple #3
0
 public void Win()
 {
     WinGame.Invoke();
     if (Input.GetKeyDown(KeyCode.Space))
     {
         StartCoroutine(ChangeToMenu());
     }
 }
Exemple #4
0
        private void WinGameCallBack(IExtensible msgData)
        {
            WinGame winGame = (WinGame)msgData;

            Debug.LogError("Win!!!!!!!!!!!!" + winGame.win);
            if (winGame.win)
            {
                Debug.LogError("Win!!!!!!!!!!!!");
            }
        }
Exemple #5
0
    // 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>();

	}
Exemple #7
0
 public static void OnWinGame(int winCount, int coinRewardCount)
 => WinGame?.Invoke(winCount, coinRewardCount);
Exemple #8
0
 void Start()
 {
     winGame = GetComponent <WinGame>();
 }
Exemple #9
0
 private void OnWinGame(EventArgs e) => WinGame?.Invoke(this, e);
Exemple #10
0
 private void Awake()
 {
     CurrentScreen = this;
     WinScreen     = gameObject;
     WinScreen.SetActive(false);
 }
Exemple #11
0
 void Start()
 {
     levelOfPage    = SceneManager.GetActiveScene().name;
     gmScript       = GameObject.FindWithTag("GameMaster").GetComponent <GameMaster>();
     winPopupScript = GameObject.Find("WinPopup").GetComponent <WinGame>();
 }