Пример #1
0
    IEnumerator PlayerAttack(float PHVal, float MeaningVal, float JoyVal)
    {
        //do attack
        enemyUnit.currentJoy        -= JoyVal * BalanceAtkJoyVal;
        enemyUnit.currentMeaning    -= MeaningVal * BalanceAtkMeaningVal;
        enemyUnit.currentPysicality -= BalanceAtkPHVal * PHVal;

        enemyHUD.JoySlider.value         = enemyUnit.currentJoy;
        enemyHUD.MeaningSlider.value     = enemyUnit.currentMeaning;
        enemyHUD.PhysicalitySlider.value = enemyUnit.currentPysicality;

        //check if dead
        if (enemyUnit.isDead() == true)
        {
            state = BattleState.WON;
            StartCoroutine(WonFunction());
        }
        else
        {
            state = BattleState.ENEMYTURN;
            yield return(new WaitForSeconds(2f));

            StartCoroutine(EnemyTurn());
        }
    }
Пример #2
0
    IEnumerator EnemyAttack(float PHVal, float MeaningVal, float JoyVal)
    {
        //do attack
        playerUnit.currentJoy        -= JoyVal * BalanceAtkJoyVal;
        playerUnit.currentMeaning    -= MeaningVal * BalanceAtkMeaningVal;
        playerUnit.currentPysicality -= PHVal * BalanceAtkPHVal;

        playerHUD.JoySlider.value         = playerUnit.currentJoy;
        playerHUD.MeaningSlider.value     = playerUnit.currentMeaning;
        playerHUD.PhysicalitySlider.value = playerUnit.currentPysicality;

        //check if dead
        if (playerUnit.isDead() == true)
        {
            state = BattleState.LOST;
            StartCoroutine(LostFunction());
        }
        else
        {
            state = BattleState.PLAYERTURN;
            yield return(new WaitForSeconds(2f));

            PlayerTurn();
        }
    }
Пример #3
0
    //CALLED BY ON ATTACKCARDUSED()
    IEnumerator PlayerAttack(float PlayerHPVal, float PlayerDefModVal, float PlayerAtkModVal, float EnemyHPVal, float EnemyDefModVal, float EnemyAtkModVal, GameObject card)
    {
        if (card.GetComponent <CardUnit>().CardName == "Soldier")
        {
            PlayerDefModVal = -PlayerDefModVal;
            PlayerAtkModVal = -PlayerAtkModVal;
        }

        //do attack change Enemy stats
        //convention card Enemyvals affect enemy
        enemyUnit.currentHP = Mathf.Round(enemyUnit.currentHP + EnemyHPVal * playerUnit.currentAtkMod / enemyUnit.currentDefMod);

        enemyUnit.currentAtkMod = enemyUnit.currentAtkMod + EnemyAtkModVal;
        enemyUnit.currentDefMod = enemyUnit.currentDefMod + EnemyDefModVal;

        if (enemyUnit.currentAtkMod < 1)
        {
            enemyUnit.currentAtkMod = 1;
        }
        if (enemyUnit.currentDefMod < 1)
        {
            enemyUnit.currentDefMod = 1;
        }

        if (enemyUnit.currentAtkMod > enemyUnit.maxAtkMod)
        {
            enemyUnit.currentAtkMod = enemyUnit.maxAtkMod;
        }
        if (enemyUnit.currentDefMod > enemyUnit.maxDefMod)
        {
            enemyUnit.currentDefMod = enemyUnit.maxDefMod;
        }

        if (enemyUnit.currentHP > enemyUnit.maxHP)
        {
            enemyUnit.currentHP = enemyUnit.maxHP;
        }
        if (enemyUnit.currentHP < 0)
        {
            enemyUnit.currentHP = 0;
        }

        enemyHUD.AtkModSlider.value = enemyUnit.currentAtkMod;
        enemyHUD.DefModSlider.value = enemyUnit.currentDefMod;
        enemyHUD.HPSlider.value     = enemyUnit.currentHP;

        //do attack changing  Player stats
        playerUnit.currentHP = Mathf.Round(playerUnit.currentHP + PlayerHPVal);

        playerUnit.currentAtkMod = playerUnit.currentAtkMod + PlayerAtkModVal;
        playerUnit.currentDefMod = playerUnit.currentDefMod + PlayerDefModVal;


        if (playerUnit.currentAtkMod < 1)
        {
            playerUnit.currentAtkMod = 1;
        }
        if (playerUnit.currentDefMod < 1)
        {
            playerUnit.currentDefMod = 1;
        }

        if (playerUnit.currentAtkMod > playerUnit.maxAtkMod)
        {
            playerUnit.currentAtkMod = playerUnit.maxAtkMod;
        }
        if (playerUnit.currentDefMod > playerUnit.maxDefMod)
        {
            playerUnit.currentDefMod = playerUnit.maxDefMod;
        }

        if (playerUnit.currentHP > playerUnit.maxHP)
        {
            playerUnit.currentHP = playerUnit.maxHP;
        }
        if (playerUnit.currentHP < 0)
        {
            playerUnit.currentHP = 0;
        }

        playerHUD.AtkModSlider.value = playerUnit.currentAtkMod;
        playerHUD.DefModSlider.value = playerUnit.currentDefMod;
        playerHUD.HPSlider.value     = playerUnit.currentHP;


        playerHUDFlash.GetComponent <Image>().color = Color.yellow;
        enemyHUDFlash.GetComponent <Image>().color  = Color.yellow;
        yield return(new WaitForSeconds(0.2f));

        playerHUDFlash.GetComponent <Image>().color = Color.blue;
        enemyHUDFlash.GetComponent <Image>().color  = Color.red;


        //check if dead
        if (enemyUnit.isDead() == true)
        {
            state = BattleState.WON;
            StartCoroutine(WonFunction());
        }
        else if (playerUnit.isDead() == true)
        {
            state = BattleState.LOST;
            StartCoroutine(LostFunction());
        }
        else if (enemyUnit.isDead() == false || playerUnit.isDead() == false)
        {
            state = BattleState.ENEMYTURN;
            yield return(new WaitForSeconds(2f));

            StartCoroutine(EnemyTurn());
        }
    }