Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            RestartPressed();
        }
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            SceneManager.LoadScene("MainGameScene");
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            SceneManager.LoadScene("Level1Scene");
        }

        // Attack type button title update
        if (playerSCR.CurrentActiveAttack() == PlayerScript.EAttackType.EMelee)
        {
            changeAttackButtonTMP.SetText("Melee: " + gridManagerSCR.meleeRequirement);
        }
        else if (playerSCR.CurrentActiveAttack() == PlayerScript.EAttackType.ERanged)
        {
            changeAttackButtonTMP.SetText("Ranged: " + gridManagerSCR.rangeRequirement);
        }

        // Game state button title update
        if (gridManagerSCR.CurrentGameState() == GridSystemManager.EGameState.EPlayerMove)
        {
            changeActionButtonTMP.SetText("Move");
        }
        else if (gridManagerSCR.CurrentGameState() == GridSystemManager.EGameState.EPlayerAttack)
        {
            changeActionButtonTMP.SetText("Attack");
        }

        // Turn title update
        if (gridManagerSCR.GetPlayersTurn())
        {
            endTurnButtonTMP.SetText("End Turn");
        }
        else if (!gridManagerSCR.GetPlayersTurn())
        {
            endTurnButtonTMP.SetText("Enemies Turn");
        }

        // Number of players turns
        turnsLeftTMP.text = "Turns Left: " + playerSCR.PlayerTurns().ToString();
        powerTMP.text     = "" + gridManagerSCR.power;
    }
 protected void Update()
 {
     playerPos    = gridManager.PlayerPosition();
     finishedTurn = (thisTurnActions <= 0 && !gridManager.GetPlayersTurn()) ? true : false;
     MoveHealthUI();
 }