public override IEnumerator Heal() { Animator playerAnim = BattleSystem.playerGO.GetComponent <Animator>(); playerAnim.SetBool("IsMagicalAttacking", true); if (BattleSystem.playerUnit.CurrentHealth == BattleSystem.playerUnit.MaxHealth) { BattleSystem.playerUnit.healHealth(BattleSystem.playerUnit.HealMove); yield return(new WaitForSeconds(BattleSystem.playerUnit.HealMove.EffectLength())); BattleSystem.AddDialogue("You've got full health already dummy!"); } else { BattleSystem.playerUnit.PreviousHealth = BattleSystem.playerUnit.CurrentHealth; BattleSystem.playerUnit.healHealth(BattleSystem.playerUnit.HealMove); yield return(new WaitForSeconds(BattleSystem.playerUnit.HealMove.EffectLength())); BattleSystem.playerHUD.SetHealedHP(BattleSystem.playerUnit); BattleSystem.AddDialogue("Looking out for yourself is very manly~"); } playerAnim.SetBool("IsMagicalAttacking", false); BattleSystem.SetState(new EnemyTurn(BattleSystem)); }
public override IEnumerator UseMove4() { BattleSystem.currentAttackMove = BattleSystem.FindMove(BattleSystem.attackChoiceButtons[3].GetComponentInChildren <Text>().text); if ((BattleSystem.playerUnit.CurrentActionPoints - BattleSystem.currentAttackMove.moveAPCost) < 0) { BattleSystem.AddDialogue("Not enough Ap! Wow you suck, how did you manage that haha!"); yield break; } BattleSystem.SetAttackState(new PlayerTurn(BattleSystem)); yield break; }
public override IEnumerator Start() { GameEvents.current.StopText(); LeanTween.scale(BattleSystem.playerGO, new Vector2(0, 0), 0.5f); yield return(new WaitForSeconds(0.5f)); GameEvents.current.FinishingUp(); BattleSystem.Destroy(BattleSystem.playerGO); BattleSystem.AddDialogue("Ugh, looks like you weren't enough."); yield return(new WaitForSeconds(3f)); Application.Quit(); }
public override IEnumerator Start() { yield return(new WaitForSeconds(1f)); // This selects a move from the list of moves that the enemy can get. int randomMoveNumber = Random.Range(0, BattleSystem.enemyUnit.UnitMoves.Length); Move randomlySelectedMove = BattleSystem.enemyUnit.UnitMoves[randomMoveNumber]; if (randomlySelectedMove.isPhysical) { LeanTween.move(BattleSystem.enemyGO, new Vector2(BattleSystem.playerBattleStation.transform.position.x - 1, BattleSystem.enemyBattleStation.transform.position.y), 1f).setEaseInBack(); yield return(new WaitForSeconds(1f)); isDead = BattleSystem.playerUnit.takeDamageFromMoveByUnit(randomlySelectedMove, BattleSystem.enemyUnit); BattleSystem.playerHUD.SetHP(BattleSystem.playerUnit); if (!isDead) { BattleSystem.AddDialogue($"Ouch, that looked like a {randomlySelectedMove.moveName}, you okay?"); } } if (randomlySelectedMove.isMagical) { isDead = BattleSystem.playerUnit.takeDamageFromMoveByUnit(randomlySelectedMove, BattleSystem.enemyUnit); yield return(new WaitForSeconds(randomlySelectedMove.EffectLength())); BattleSystem.playerHUD.SetHP(BattleSystem.playerUnit); if (!isDead) { BattleSystem.AddDialogue($"That was a {randomlySelectedMove.moveName}. Eesh, that thing can aim haha."); } } // Player moves back to position. LeanTween.move(BattleSystem.enemyGO, BattleSystem.enemyBattleStation.transform.position, 1f).setEaseInBack(); yield return(new WaitForSeconds(2f)); GameEvents.current.StopText(); if (isDead) { BattleSystem.SetState(new Lost(BattleSystem)); } else { BattleSystem.SetState(new PlayerTurn(BattleSystem)); } }
public override IEnumerator Start() { // Instantiates the two characters in the scene, and sets up the components for both of them. BattleSystem.playerGO = BattleSystem.Instantiate(BattleSystem.playerCharacters, BattleSystem.playerBattleStation); BattleSystem.enemyGO = BattleSystem.Instantiate(BattleSystem.enemyCharacters, BattleSystem.enemyBattleStation); BattleSystem.playerUnit = BattleSystem.playerGO.GetComponent <PlayerCharacterUnit>(); BattleSystem.enemyUnit = BattleSystem.enemyGO.GetComponent <Unit>(); BattleSystem.currentPlayerMove = BattleSystem.playerUnit.UnitMoves; Animator playerAnim = BattleSystem.playerGO.GetComponent <Animator>(); playerAnim.SetBool("IsWalkingLeft", true); for (int i = 0; i < BattleSystem.attackChoiceButtons.Length; i++) { if (BattleSystem.currentPlayerMove[i] != null) { BattleSystem.attackChoiceButtons[i].GetComponentInChildren <Text>().text = BattleSystem.currentPlayerMove[i].moveName; } else { BattleSystem.attackChoiceButtons[i].SetActive(false); } } BattleSystem.AddDialogue( "Welcome to the battle, Puppet. You can continue the text by clicking on the text box~", "That's a wild one, if you're not careful. Well, I think you know what can happen~", "Have fun! <3"); //Hooks up the units to their respective HUDs. BattleSystem.playerHUD.SetHUD(BattleSystem.playerUnit); BattleSystem.enemyHUD.SetHUD(BattleSystem.enemyUnit); yield return(new WaitForSeconds(2f)); playerAnim.SetBool("IsWalkingLeft", false); BattleSystem.SetState(new PlayerTurn(BattleSystem)); }
public override IEnumerator Start() { LeanTween.moveLocal(BattleSystem.enemyGO, new Vector3(-20, 0, BattleSystem.enemyGO.transform.position.z), 2f); yield return(new WaitForSeconds(0.5f)); BattleSystem.Destroy(BattleSystem.enemyGO); GameEvents.current.StopText(); yield return(new WaitForSeconds(0.15f)); GameEvents.current.FinishingUp(); BattleSystem.AddDialogue("Darn, it ran.", "Well it doesn't matter. Good work Puppet, you don't seem entirely useless", "Thanks for playing~", "The game should close on it's own.", "Lmao it's still on", "Any second now", "Hitler did nothing wrong" , "What" , "A man can have a view" , "Don't judge me" , "You probably think this is a bit much", "But whatever it's my game not yours <3" , "Anyways why are you sill here.", "You must be really trying for this text", "Maybe hoping to find a secret message.", "Well you're not getting one", "Or are you?", "Maybe if you check the first letters of every sentence in this screen you can find out <3", " " , " " , " " , " ", "Damn did you actually do that?", "Wow you're stupid you think I could be asked with that?", "Listen, I ain't that much of a loser to take my time to type a long ass puzzle for you", "I have much better uses of my time :)", "If you came this far. I'd just like to say thank you!"); yield return(new WaitForSeconds(15f)); Application.Quit(); }
public override IEnumerator Attack() { // Stop all current text and refreshes it into a empty string. GameEvents.current.StopText(); Animator playerAnim = BattleSystem.playerGO.GetComponent <Animator>(); // Removes panel from scene. BattleSystem.battlePanelAttackButton.interactable = false; BattleSystem.battlePanelHealButton.interactable = false; // Animates choice panel out of the screen. LeanTween.moveLocal(BattleSystem.attackChoicePanel, BattleSystem.attackChoicePanelStartPos, 0.2f); yield return(new WaitForSeconds(0.2f)); // When the attack used is physical. if (BattleSystem.currentAttackMove.isPhysical == true && BattleSystem.currentAttackMove.isMagical == false) { // Player moves to enemy. LeanTween.move(BattleSystem.playerGO, new Vector2(BattleSystem.enemyBattleStation.transform.position.x + 1, BattleSystem.enemyBattleStation.transform.position.y), 1f).setEaseInBack(); // IsWalkingLeft starts the animation for walking left playerAnim.SetBool("IsWalkingLeft", true); yield return(new WaitForSeconds(1f)); playerAnim.SetBool("IsWalkingLeft", false); // IsPhysicalAttacking starts the animation for physical attacks. playerAnim.SetBool("IsPhysicalAttacking", true); // This initializes the previous health. BattleSystem.enemyUnit.PreviousHealth = BattleSystem.enemyUnit.CurrentHealth; BattleSystem.playerUnit.PreviousActionPoints = BattleSystem.playerUnit.CurrentActionPoints; // Checks for the damage done to the enemy, returns a bool if the damage is sufficent for killing the enemy. isDead = BattleSystem.enemyUnit.takeDamageFromMoveByUnit(BattleSystem.currentAttackMove, BattleSystem.playerUnit); yield return(new WaitForSeconds(BattleSystem.currentAttackMove.EffectLength())); BattleSystem.enemyHUD.SetHP(BattleSystem.enemyUnit); BattleSystem.playerHUD.SetAP(BattleSystem.playerUnit); playerAnim.SetBool("IsPhysicalAttacking", false); if (!isDead) { BattleSystem.AddDialogue( "Attack connected, damn!", "Nice going Puppet!"); } // Player moves back to position. // IsWalkingLeft starts the animation for walking right. playerAnim.SetBool("IsWalkingRight", true); LeanTween.move(BattleSystem.playerGO, BattleSystem.playerBattleStation.transform.position, 1f).setEaseInBack(); yield return(new WaitForSeconds(0.8f)); playerAnim.SetBool("IsWalkingRight", false); } // This is for non physical attacks. else if (BattleSystem.currentAttackMove.isMagical == true && BattleSystem.currentAttackMove.isPhysical == false) { playerAnim.SetBool("IsMagicalAttacking", true); BattleSystem.enemyUnit.PreviousHealth = BattleSystem.enemyUnit.CurrentHealth; BattleSystem.playerUnit.PreviousActionPoints = BattleSystem.playerUnit.CurrentActionPoints; isDead = BattleSystem.enemyUnit.takeDamageFromMoveByUnit(BattleSystem.currentAttackMove, BattleSystem.playerUnit); yield return(new WaitForSeconds(BattleSystem.currentAttackMove.EffectLength())); BattleSystem.enemyHUD.SetHP(BattleSystem.enemyUnit); BattleSystem.playerHUD.SetAP(BattleSystem.playerUnit); playerAnim.SetBool("IsMagicalAttacking", false); if (!isDead) { BattleSystem.AddDialogue( "Nice aim!"); } } else { BattleSystem.playerUnit.PreviousHealth = BattleSystem.playerUnit.CurrentHealth; isDead = BattleSystem.enemyUnit.takeDamageFromMoveByUnit(BattleSystem.currentAttackMove, BattleSystem.playerUnit); BattleSystem.enemyHUD.SetHP(BattleSystem.enemyUnit); yield return(new WaitForSeconds(BattleSystem.currentAttackMove.EffectLength())); if (!isDead) { BattleSystem.AddDialogue( "ADAIUdIUGWGDAIYDASDAS!"); } } if (isDead) { //Player Wins BattleSystem.SetState(new Won(BattleSystem)); } else { //Goes to enemy turn. BattleSystem.SetState(new EnemyTurn(BattleSystem)); } }