private void isenemyHited(int num) { if (attack.getIsEnemyHited() && enemyManager.getCurrentMove(num) != "ShieldEnemy") { float u = DamageArray[num]; enemyManager.setTotalHpEnemy(enemyManager.getTotalHpEnemy() - DamageArray[num]); if (enemyManager.getTotalHpEnemy() < 0) { u = DamageArray[num] + enemyManager.getTotalHpEnemy(); } hpbarEnemy.TakeStamina(u, enemyManager.getHpEnemy()); Debug.Log("mmmmmmmmmmmmmmmmmm " + enemyManager.getTotalHpEnemy()); } }
private void isplayerHited(int num) { if (attack.getIsPlayerHited() && MoveOrderArray[num] != "Shield") { float y = enemyManager.getCurrentdamageMove(num); playerManager.setTotalHpPlayer(playerManager.getTotalHpPlayer() - y); if (playerManager.getTotalHpPlayer() < 0) { y = y + enemyManager.getTotalHpEnemy(); } hpbarPlayer.TakeStamina(y, playerManager.getHpPlayer()); Debug.Log("ooooooooooooooooo " + playerManager.getTotalHpPlayer()); } }
IEnumerator Continue() { screenManager.isScreen(); yield return(new WaitForSeconds(2)); setActiveCards(); enemyManager.pickAttacks(attack.getCrntRow(), attack.getCrntClmns(), attack.getEnemyCrntRow(), attack.getEnemyCrntClmns()); for (int i = 0; i < MoveOrderArray.Length; i++) { if (PlayerBeforeEnemy(i) == true) { WhichMove(MoveOrderArray[i]); direction(); isenemyHited(i); staiminabarPlayer.TakeStamina(StaminaArray[i], PlayerData.Stamina); yield return(new WaitForSeconds(2)); DeleteImageButton(i.ToString()); if (MoveOrderArray[i] != "Shield") { foreach (Transform SquareFloor in BlocksArray.transform) { SquareFloor.gameObject.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255); } yield return(new WaitForSeconds(1)); } if (enemyManager.getTotalHpEnemy() <= 0) { Debug.Log("you won"); i = 2; stop = true; Destroy(enemy); winOrLoseWindow(true); } if (stop == false) { WhichMove(enemyManager.getCurrentMove(i)); direction(); isplayerHited(i); staiminabarEnemy.TakeStamina(enemyManager.getCurrentstaminaMove(i), enemyManager.getStaminaEnemy()); yield return(new WaitForSeconds(2)); } } else { WhichMove(enemyManager.getCurrentMove(i)); direction(); isplayerHited(i); staiminabarEnemy.TakeStamina(enemyManager.getCurrentstaminaMove(i), enemyManager.getStaminaEnemy()); yield return(new WaitForSeconds(2)); if (enemyManager.getCurrentMove(i) != "ShieldEnemy") { foreach (Transform SquareFloor in BlocksArray.transform) { SquareFloor.gameObject.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255); } yield return(new WaitForSeconds(1)); } if (playerManager.getTotalHpPlayer() <= 0) { Debug.Log("you lost"); i = 2; stop = true; Destroy(player); winOrLoseWindow(false); } if (stop == false) { WhichMove(MoveOrderArray[i]); //hpbarPlayer.TakeStamina(-ifHeal, playerManager.getHpPlayer()); //ifHeal = 0; direction(); isenemyHited(i); staiminabarPlayer.TakeStamina(StaminaArray[i], PlayerData.Stamina); yield return(new WaitForSeconds(2)); DeleteImageButton(i.ToString()); } } if (playerManager.getTotalHpPlayer() <= 0) { Debug.Log("you lost"); i = 2; stop = true; Destroy(player); winOrLoseWindow(false); } if (enemyManager.getTotalHpEnemy() <= 0) { Debug.Log("you won"); i = 2; stop = true; Destroy(enemy); winOrLoseWindow(true); } foreach (Transform SquareFloor in BlocksArray.transform) { SquareFloor.gameObject.GetComponent <SpriteRenderer>().color = new Color(255, 255, 255); } yield return(new WaitForSeconds(1)); } if (stop == false) { PlayNum = 0; isFull = false; for (int i = 0; i < MoveOrderArray.Length; i++) { MoveOrderArray[i] = ""; } if (playerManager.getTotalStaminaPlayer() + playerManager.getStaminaBonus() > 100) { playerManager.setTotalStamina(100); } else { playerManager.setTotalStamina(playerManager.getTotalStaminaPlayer() + playerManager.getStaminaBonus()); } staiminabarPlayer.TakeStamina(-playerManager.getStaminaBonus(), PlayerData.Stamina); staiminabarPlayer.resetStats(playerManager.getTotalStaminaPlayer()); staiminabarEnemy.TakeStamina(-enemyManager.getStaminaBonus(), enemyManager.getStaminaEnemy()); staiminabarEnemy.resetStats(enemyManager.getTotalStaminaEnemy()); for (int i = 0; i < StaminaArray.Length; i++) { //Debug.Log("stamina array " + i + " " + StaminaArray[i]); StaminaArray[i] = 0f; } MoreStamina(); screenManager.isContinueB(); enemyManager.ResetEnemy(); CourtPositions(); Debug.Log("choose moves again"); } }