// Start is called before the first frame update void Start() { MarkerManagerScript.S.Reset(); CharacterManagerScript.StartCombat(); firstAttack = 0; secondAttack = 0; netrixiAttacks = false; folkvarAttacks = false; ivAttacks = false; NetrixiCombatScript.ResetNetrixiVariables(); FolkvarCombatScript.ResetFolkvarVariables(); IvCombatScript.ResetIvVariables(); isNetrixi = true; isFolkvar = true; isIv = true; roundNumber = 1; // Determine which characters are in the scene netrixiAlive = true; if (GameManagerScript.folkvarInParty) { folkvarAlive = true; } else { folkvarAlive = false; } if (GameManagerScript.ivInParty) { ivAlive = true; } else { ivAlive = false; } // Determine which enemies are in the scene enemy1Alive = true; if (EnemyManagerScript.enemy2 == "null") { enemy2Alive = false; canEnemy2Attack = false; } else { enemy2Alive = true; } if (EnemyManagerScript.enemy3 == "null") { enemy3Alive = false; canEnemy3Attack = false; } else { enemy3Alive = true; } playerAttacking1 = false; playerAttacking2 = false; enemyAttacking1 = false; enemyAttacking2 = false; // Reset any transformed enemies if (!canEnemy1Attack) { NetrixiAttackScript.enemy1Transformed = false; } if (!canEnemy2Attack) { NetrixiAttackScript.enemy2Transformed = false; } if (!canEnemy3Attack) { NetrixiAttackScript.enemy3Transformed = false; } canEnemy1Attack = true; canEnemy2Attack = true; canEnemy3Attack = true; // If only Netrixi is present in the scene //if (netrixiAlive && !folkvarAlive && !ivAlive) netrixiAttacks = true; win = false; lose = false; hasWon = false; hasLost = false; enemy1StartingHP = enemy1HP; enemy2StartingHP = enemy2HP; enemy3StartingHP = enemy3HP; }
public static void FolkvarMeleeAttack() { // Folkvar uses his first melee attack if (FolkvarCombatScript.folkvarCondition1[0] && FolkvarCombatScript.folkvarCondition1[1]) { print("Folkvar uses his first attack"); // Make Folkvar attack in game if (firstAttack != 0) { hasRunSimulation = false; if (secondAttack == 0) { if (firstAttack != 4) { secondAttack = 4; } else { print("Can't choose the same move twice"); } } } else { firstAttack = 4; } FolkvarCombatScript.ResetFolkvarVariables(); } // Folkvar uses his second melee attack if (FolkvarCombatScript.folkvarCondition2[0] && FolkvarCombatScript.folkvarCondition2[1] && FolkvarCombatScript.folkvarCondition2[2]) { print("Folkvar uses his second attack"); // Make Folkvar attack in game if (firstAttack != 0) { hasRunSimulation = false; if (secondAttack == 0) { if (firstAttack != 5) { secondAttack = 5; } else { print("Can't choose the same move twice"); } } } else { firstAttack = 5; } FolkvarCombatScript.ResetFolkvarVariables(); } // Folkvar uses his third melee attack if (FolkvarCombatScript.folkvarCondition3[0] && FolkvarCombatScript.folkvarCondition3[1] && FolkvarCombatScript.folkvarCondition3[2]) { print("Folkvar uses his third attack"); // Make Folkvar attack in game if (firstAttack != 0) { hasRunSimulation = false; if (secondAttack == 0) { if (firstAttack != 6) { secondAttack = 6; } else { print("Can't choose the same move twice"); } } } else { firstAttack = 6; } FolkvarCombatScript.ResetFolkvarVariables(); } // Folkvar moves if (FolkvarCombatScript.folkvarCondition4[0]) { // If Folkvar moves to the left if (FolkvarCombatScript.folkvarCondition4[1]) { print("Folkvar moves to the left"); // Make Folkvar move in game if (firstAttack != 0) { hasRunSimulation = false; if (secondAttack == 0) { secondAttack = 12; } } else { firstAttack = 12; } FolkvarCombatScript.ResetFolkvarVariables(); } // If Folkvar moves to the right if (FolkvarCombatScript.folkvarCondition4[2]) { print("Folkvar moves to the right"); // Make Folkvar move in game if (firstAttack != 0) { hasRunSimulation = false; if (secondAttack == 0) { secondAttack = 13; } } else { firstAttack = 13; } FolkvarCombatScript.ResetFolkvarVariables(); } } }
public IEnumerator RunSimulation(int playerFirstAttack, int playerSecondAttack, string enemyFirstAttack, string enemySecondAttack, GameObject runner) { CombatManagerScript.netrixiAttacks = false; CombatManagerScript.folkvarAttacks = false; CombatManagerScript.ivAttacks = false; // FIRST ATTACK yield return(new WaitForSecondsRealtime(moveDelay)); // Check to see if any Main Characters move for their first attack CheckForPlayerMovement(playerFirstAttack, 1); // If any Main Characters did move for their first attack if (didPlayerMove1) { yield return(new WaitForSecondsRealtime(moveDelay)); } // Check to see if any Enemy Characters move for their first attack CheckForEnemyMovement(enemyFirstAttack, 1); // If any Enemy Characters did move for their first attack if (didEnemyMove1) { yield return(new WaitForSecondsRealtime(moveDelay)); } // Check to see what the player's first attack is if (!didPlayerMove1) { AttackScript.PlayerAttack(playerFirstAttack, 1); CombatManagerScript.playerAttacking1 = true; AttackScript.enemyAttack = !AttackScript.enemyAttack; // Wait for attack animation to play yield return(new WaitForSecondsRealtime(attack1Delay)); } // Check to see what the enemy's first attack is if (!didEnemyMove1) { AttackScript.EnemyAttack(enemyFirstAttack, 1, enemyAttacker1); CombatManagerScript.enemyAttacking1 = true; AttackScript.playerAttack = !AttackScript.playerAttack; // Wait for attack animation to play yield return(new WaitForSecondsRealtime(attack1Delay)); } // SECOND ATTACK // Check to see if any Main Characters move for their second attack CheckForPlayerMovement(playerSecondAttack, 2); // If any Main Characters did move for their second attack if (didPlayerMove2) { yield return(new WaitForSecondsRealtime(moveDelay)); } // Check to see if any Enemy Characters move for their second attack CheckForEnemyMovement(enemySecondAttack, 2); // If any Enemy Characters did move for their second attack if (didEnemyMove2) { yield return(new WaitForSecondsRealtime(moveDelay)); } // Check to see what the player's second attack is if (!didPlayerMove2) { AttackScript.PlayerAttack(playerSecondAttack, 2); CombatManagerScript.playerAttacking2 = true; AttackScript.enemyAttack = !AttackScript.enemyAttack; // Wait for attack animation to play yield return(new WaitForSecondsRealtime(attack2Delay)); } // Check to see what the enemy's second attack is if (!didEnemyMove2) { AttackScript.EnemyAttack(enemySecondAttack, 2, enemyAttacker2); CombatManagerScript.enemyAttacking2 = true; AttackScript.playerAttack = !AttackScript.playerAttack; // Wait for attack animation to play yield return(new WaitForSecondsRealtime(attack2Delay)); } // Reset variables once simulation is finished CombatManagerScript.firstAttack = 0; CombatManagerScript.secondAttack = 0; NetrixiCombatScript.ResetNetrixiVariables(); FolkvarCombatScript.ResetFolkvarVariables(); IvCombatScript.ResetIvVariables(); CombatManagerScript.roundNumber += 1; CombatManagerScript.playerAttacking1 = false; CombatManagerScript.playerAttacking2 = false; CombatManagerScript.enemyAttacking1 = false; CombatManagerScript.enemyAttacking2 = false; CombatManagerScript.target1Location = 0; CombatManagerScript.target2Location = 0; CharacterManagerScript.ResetVariables(); EnemyManagerScript.ClearMoves(); didPlayerMove1 = false; didPlayerMove2 = false; didEnemyMove1 = false; didEnemyMove2 = false; // If only one character is alive //if (CombatManagerScript.netrixiAlive && !CombatManagerScript.folkvarAlive && !CombatManagerScript.ivAlive) CombatManagerScript.netrixiAttacks = true; //if (!CombatManagerScript.netrixiAlive && CombatManagerScript.folkvarAlive && !CombatManagerScript.ivAlive) CombatManagerScript.folkvarAttacks = true; //if (!CombatManagerScript.netrixiAlive && !CombatManagerScript.folkvarAlive && CombatManagerScript.ivAlive) CombatManagerScript.ivAttacks = true; Destroy(runner); }