示例#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;
    }
示例#2
0
    private void HightlightGround()
    {
        if (lastCast.transform ?? false)
        {
            if (gridManager.CurrentGameState() == GridSystemManager.EGameState.EEnemyAttack ||
                gridManager.CurrentGameState() == GridSystemManager.EGameState.EEnemyMove)
            {
                // Enemy Turn
                notPlayerTurnSPR.SetActive(true);
                notPlayerTurnSPR.transform.position = lastCast.transform.position;

                canAttackSPR.SetActive(false);
                canNotAttackSPR.SetActive(false);
                playerMoveSPR.SetActive(false);
            }
            else
            {
                notPlayerTurnSPR.SetActive(false);

                // Player turn
                if (gridManager.CurrentGameState() == GridSystemManager.EGameState.EPlayerMove)
                {
                    if (lastCast.transform.CompareTag("Highlighted") || lastCast.transform.CompareTag("Bushes"))
                    {
                        playerMoveSPR.SetActive(true);
                        playerMoveSPR.transform.position = lastCast.transform.position;

                        // Deactivate other sprites
                        canNotAttackSPR.SetActive(false);
                        canAttackSPR.SetActive(false);
                        notPlayerTurnSPR.SetActive(false);
                    }
                    else
                    {
                        canNotAttackSPR.SetActive(true);
                        canNotAttackSPR.transform.position = lastCast.transform.position;

                        // Deactivate other sprites
                        playerMoveSPR.SetActive(false);
                        canAttackSPR.SetActive(false);
                        notPlayerTurnSPR.SetActive(false);
                    }
                }
                else if (currentAttack == EAttackType.EMelee)
                {
                    playerMoveSPR.SetActive(false);

                    if (lastCast.transform.CompareTag("Highlighted") || lastCast.transform.CompareTag("Bushes"))
                    {
                        canAttackSPR.SetActive(true);
                        canAttackSPR.transform.position = lastCast.transform.position;
                        canNotAttackSPR.SetActive(false);
                    }
                    else
                    {
                        canNotAttackSPR.SetActive(true);
                        canNotAttackSPR.transform.position = lastCast.transform.position;
                        canAttackSPR.SetActive(false);
                    }
                }
                else if (currentAttack == EAttackType.ERanged)
                {
                    playerMoveSPR.SetActive(false);

                    if (lastCast.transform.CompareTag("Highlighted") || lastCast.transform.CompareTag("Bushes"))
                    {
                        canAttackSPR.SetActive(true);
                        canAttackSPR.transform.position = lastCast.transform.position;
                        canNotAttackSPR.SetActive(false);
                    }
                    else
                    {
                        canNotAttackSPR.SetActive(true);
                        canNotAttackSPR.transform.position = lastCast.transform.position;
                        canAttackSPR.SetActive(false);
                    }
                }
            }
        }
    }