// Update is called once per frame void Update() { if (BattleMachine2.IsEnemyChoosing) { RandomState.StateLimits = 4; RandomState.RandomStateMethod(); Debug.Log("Virus 3 is Choosing"); switch (RandomState.StateE) { case 1: _states.Attack(); Debug.Log("2-Attack"); Enemy3.IsVirus3Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; case 2: _states.Pixeling(); Debug.Log("2-Pixel"); Enemy3.IsVirus3Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; case 3: _states.Light(); Debug.Log("2-Light"); Enemy3.IsVirus3Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; case 4: _states.Bug(); Debug.Log("2-Bug"); Enemy3.IsVirus3Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; default: _states.Iddle(); Debug.Log("3-idle"); break; } } }
void Update() { if (Enemy.IsVirus1Playing) { RandomState.StateLimits = 3; RandomState.RandomStateMethod(); Debug.Log("Virus is choosing"); switch (RandomState.StateE) { case 1: _states.Attack(); Debug.Log("2-Invisibility"); Enemy.IsVirus1Playing = false; BattleMachine.IsEnemyChoosing = false; BattleMachine.OnPlayerTurn = true; break; case 2: _states.Attack(); Debug.Log("2-Attack"); Enemy.IsVirus1Playing = false; BattleMachine.IsEnemyChoosing = false; BattleMachine.OnPlayerTurn = true; break; case 3: _states.Scanner(); Debug.Log("2-Scanner"); Enemy.IsVirus1Playing = false; BattleMachine.IsEnemyChoosing = false; BattleMachine.OnPlayerTurn = true; break; default: Debug.Log("el enemy no hace nada we"); _states.Iddle(); Enemy.IsVirus1Playing = false; BattleMachine.IsEnemyChoosing = false; BattleMachine.OnPlayerTurn = true; break; } } }
// Start is called before the first frame update void Update() { if (Enemy.IsVirus1Playing) { RandomState.StateLimits = 3; RandomState.RandomStateMethod(); switch (RandomState.StateE) { case 1: _states.Shoot(); Debug.Log("2-Shoot"); Enemy3.IsVirus2Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; case 2: _states.Block(); Debug.Log("2-Blocking"); Enemy3.IsVirus2Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; case 3: _states.Steal(); Debug.Log("2-Steal"); Enemy3.IsVirus2Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; default: _states.Iddle(); Debug.Log("2-Iddle"); Enemy3.IsVirus2Playing = false; BattleMachine3.IsEnemyChoosing = false; BattleMachine3.OnPlayerTurn = true; break; } } }
void Update() { switch (states) { case BattleStates.Start: this.setActivateButtonStatePlayerEnemy(1); break; case BattleStates.PlayerSelection: this.dialogText.text = "Select Hacker H o E , Life energy Hacker: " + this.scoreData.hLife + ", Mago: " + this.scoreData.mLife + "\n Vida del enemigo 1 " + lifeBattleVirus1 + " Vida del enemigo 2: " + lifeBattleVirus2; Debug.Log("H o E"); if (Input.GetKeyDown(KeyCode.H) || this.botonPresionado == 1) { Player.IsHackerPlaying = true; dialogText.text = "You selected hacker"; states = BattleStates.EnemySelection; } else if (Input.GetKeyDown(KeyCode.E) || this.botonPresionado == 2) { dialogText.text = "You selected mago"; Player.IsMagoPlaying = true; states = BattleStates.EnemySelection; } break; case BattleStates.SkillSelection: this.dialogText.text = "Select an action \n\n ScoreData ShootPoint: " + scoreData.shootingPoints; if (Player.IsMagoPlaying) { if (Input.GetKeyDown(KeyCode.H)) { _damage = 5; // _states.Pixeling(); Debug.Log("pixel"); Player.IsMagoPlaying = false; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(KeyCode.K) && Mago.Instance._electricityLimit > 0) { _damage = 10; scoreData.xp += 10; //_states.Electricity(); Debug.Log("Electricity"); Player.IsMagoPlaying = false; Mago.Instance._electricityLimit--; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(KeyCode.L) && scoreData.mana >= 25) { //_states.Light(); Debug.Log("Light"); _damage = 15; scoreData.mana -= 25; Player.IsMagoPlaying = false; RestScore(); states = BattleStates.Enemyturn; scoreData.xp += 10; } else if (Input.GetKeyDown(KeyCode.M) && shopData.healSold == true) { scoreData.hLife = 100; scoreData.mLife = 100; scoreData.mana = 0; Debug.Log("heal"); _damage = 0; Player.IsMagoPlaying = false; RestScore(); scoreData.xp += 5; states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(KeyCode.N) && shopData.electroshockSold == true) { _damage = 20; Debug.Log("electroshock"); Player.IsMagoPlaying = false; scoreData.xp += 5; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(KeyCode.O) && shopData.updateSold == true) { scoreData.mLife += 50; _damage = 0; Debug.Log("update"); Player.IsMagoPlaying = false; RestScore(); states = BattleStates.Enemyturn; } if (lifeBattleVirus1 <= 0 & lifeBattleVirus2 <= 0) { states = BattleStates.Won; } } else if (Player.IsHackerPlaying) { if (Input.GetKey(KeyCode.H)) { _damage = 5; Debug.Log("1"); Player.IsHackerPlaying = false; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKey(KeyCode.K)) { _damage = 10; Debug.Log("2"); Player.IsHackerPlaying = false; scoreData.xp += 5; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKey(KeyCode.L) && scoreData.mana >= 25) //añadir condicion { _damage = 15; scoreData.mana -= 25; Debug.Log("3"); scoreData.xp += 10; Player.IsHackerPlaying = false; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(KeyCode.M) && shopData.resettingSold == true) { scoreData.hLife = 100; scoreData.mana += 25; Debug.Log("4 shop"); Player.IsHackerPlaying = false; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(KeyCode.N) && shopData.controlzSold == true) { scoreData.hLife = +_damage; _damage = 0; Debug.Log("5 shop"); Player.IsHackerPlaying = false; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(KeyCode.O) && shopData.deleteSold == true) { _damage = 20; scoreData.xp += 5; Debug.Log("6 shop"); Player.IsHackerPlaying = false; RestScore(); states = BattleStates.Enemyturn; } } break; case BattleStates.EnemySelection: this.dialogText.text = "Select an anemy to attack"; Debug.Log("B o V"); this.setActivateButtonStatePlayerEnemy(2); if (Input.GetKey(KeyCode.V)) { this.dialogText.text = ("Attack to Virus 1"); virus1Choosed = true; states = BattleStates.SkillSelection; } else if (Input.GetKey(KeyCode.B)) { this.dialogText.text = ("Attack to Virus 2"); virus2Choosed = true; states = BattleStates.SkillSelection; } if (lifeBattleVirus1 <= 0 & lifeBattleVirus2 <= 0) { states = BattleStates.Won; EndBattle(); } break; case BattleStates.Enemyturn: Debug.Log("Enemy Turn"); dialogText.text = "Enemy Turn"; if (c % 2 == 0) { this.dialogText.text = ("Enemy 1 Selected"); Debug.Log("enemy 1"); Virus1 virus1Controller = virus1.GetComponent <Virus1>(); Enemy.IsVirus1Playing = true; dialogText.text = "Virus 1 Attacking! \n\n" + virus1Controller.ToString(); states = BattleStates.EnemySelect; //states = BattleStates.Enemyturn; } else { this.dialogText.text = ("Enemy 2 Selected"); Debug.Log("enemy 2"); Virus1 virus2Controller = virus2.GetComponent <Virus1>(); Enemy.IsVirus1Playing = true; this.dialogText.text = "" + virus2Controller.ToString(); dialogText.text = "Virus 2 Attacking! " + virus2Controller.ToString(); states = BattleStates.EnemySelect; //states = BattleStates.Enemyturn; } c++; break; case BattleStates.EnemySelect: RandomState.StateLimits = 3; RandomState.RandomStateMethod(); this.dialogText.text = ("Virus is choosing"); switch (RandomState.StateE) { case 1: //_states.Attack(); _damage = 5; this.dialogText.text = ("2-Invisibility"); Debug.Log("enemy"); Enemy.IsVirus1Playing = false; states = BattleStates.EnemySelectPlayer; break; case 2: //_states.Attack(); _damage = 10; this.dialogText.text = ("2-Attack"); Debug.Log("enemy"); Enemy.IsVirus1Playing = false; states = BattleStates.EnemySelectPlayer; break; case 3: //_states.Scanner(); _damage = 15; this.dialogText.text = ("2-Scanner"); Debug.Log("enemy"); Enemy.IsVirus1Playing = false; states = BattleStates.EnemySelectPlayer; break; default: this.dialogText.text = ("No anda el virus"); Enemy.IsVirus1Playing = false; break; } //states = BattleStates.EnemySelect; //Esto lo puse yo para probar break; case BattleStates.EnemySelectPlayer: if (RandomState.StateE % 2 == 0) { this.dialogText.text = ("Attack to Hacker"); Debug.Log("to hacker"); scoreData.hLife = scoreData.hLife - _damage; //states = BattleStates.PlayerSelection; } else { this.dialogText.text = ("Attack to Mago"); Debug.Log("to mago"); scoreData.mLife = scoreData.mLife - Virus1.Instance._damage; //states = BattleStates.PlayerSelection; } //Le ponemos un OR exclusivo if (scoreData.hLife <= 0 || scoreData.mLife <= 0) //el score es la vida de los players { states = BattleStates.Lost; EndBattle(); } //this.dialogText.text = "Vida del personaje " + scoreData.mLife + ", hacker: " + scoreData.hLife; //Esto lo puse yo para probar states = BattleStates.PlayerSelection; break; default: break; } /* if (OnPlayerTurn) * { * states = BattleStates.PlayerTurn; * StartCoroutine(PlayerTurn()); * } * else if (!OnPlayerTurn) * { * states = BattleStates.Enemyturn; * StartCoroutine(EnemyTurn()); * }*/ }
void Update() { switch (states) { case BattleStates.Start: break; case BattleStates.PlayerSelection: Debug.Log("Select Hacker o E"); if (Input.GetKeyDown(KeyCode.H)) { Player.IsHackerPlaying = true; dialogText.text = "You selected hacker"; states = BattleStates.EnemySelection; } else if (Input.GetKeyDown(KeyCode.E)) { dialogText.text = "You selected mago"; Player.IsMagoPlaying = true; states = BattleStates.EnemySelection; } break; case BattleStates.SkillSelection: Debug.Log("Select an action"); if (Player.IsMagoPlaying) { if (Input.GetKeyDown(_pixelKey)) { _damage = 5; // _states.Pixeling(); Debug.Log("pixel"); Player.IsMagoPlaying = false; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(_electricityKey) && Mago.Instance._electricityLimit > 0) { _damage = 10; //_states.Electricity(); Debug.Log("Electricity"); Player.IsMagoPlaying = false; Mago.Instance._electricityLimit--; RestScore(); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(_LightingKey) && scoreData.shootingPoints == 100) { _damage = 15; //_states.Light(); Debug.Log("Light"); Player.IsMagoPlaying = false; RestScore(); states = BattleStates.Enemyturn; scoreData.shootingPoints = 0; } if (lifeBattleVirus1 <= 0 & lifeBattleVirus2 <= 0) { states = BattleStates.Won; } } else if (Player.IsHackerPlaying) { if (Input.GetKeyDown(bugKey)) { _damage = 5; Debug.Log("1"); states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(copyKey)) { _damage = 10; Debug.Log("2"); Hacker.Instance._damage = 10; states = BattleStates.Enemyturn; } else if (Input.GetKeyDown(stealKey)) //añadir condicion { _damage = 15; Debug.Log("3"); states = BattleStates.Enemyturn; } } break; case BattleStates.EnemySelection: Debug.Log("Select an anemy to attack"); if (Input.GetKeyDown(KeyCode.Keypad1)) { Debug.Log("Attack to Virus 1"); virus1Choosed = true; states = BattleStates.SkillSelection; } else if (Input.GetKeyDown(KeyCode.Keypad2)) { Debug.Log("Attack to Virus 2"); virus2Choosed = true; states = BattleStates.SkillSelection; } if (lifeBattleVirus1 <= 0 & lifeBattleVirus2 <= 0) { states = BattleStates.Won; EndBattle(); } break; case BattleStates.Enemyturn: dialogText.text = "Enemy Turn"; if (c % 2 == 0) { Debug.Log("Enemy 1 Selected"); dialogText.text = "Virus 1 Attacking!"; Virus1 virus1Controller = virus1.GetComponent <Virus1>(); Enemy.IsVirus1Playing = true; states = BattleStates.EnemySelect; } else { Debug.Log("Enemy 2 Selected"); dialogText.text = "Virus 2 Attacking!"; Virus1 virus2Controller = virus2.GetComponent <Virus1>(); Enemy.IsVirus1Playing = true; states = BattleStates.EnemySelect; } c++; break; case BattleStates.EnemySelect: RandomState.StateLimits = 3; RandomState.RandomStateMethod(); Debug.Log("Virus is choosing"); switch (RandomState.StateE) { case 1: //_states.Attack(); _damage = 5; Debug.Log("2-Invisibility"); Enemy.IsVirus1Playing = false; states = BattleStates.EnemySelectPlayer; break; case 2: //_states.Attack(); _damage = 10; Debug.Log("2-Attack"); Enemy.IsVirus1Playing = false; states = BattleStates.EnemySelectPlayer; break; case 3: //_states.Scanner(); _damage = 15; Debug.Log("2-Scanner"); Enemy.IsVirus1Playing = false; states = BattleStates.EnemySelectPlayer; break; default: Debug.Log("No anda el virus"); Enemy.IsVirus1Playing = false; break; } break; case BattleStates.EnemySelectPlayer: if (RandomState.StateE % 2 == 0) { Debug.Log("Attack to Hacker"); scoreData.hLife = scoreData.hLife - _damage; states = BattleStates.PlayerSelection; } else { Debug.Log("Attack to Electroquinetic"); scoreData.mLife = scoreData.mLife - Virus1.Instance._damage; states = BattleStates.PlayerSelection; } if (scoreData.hLife <= 0 & scoreData.mLife <= 0) //el score es la vida de los players { states = BattleStates.Lost; EndBattle(); } break; default: break; } /* if (OnPlayerTurn) * { * states = BattleStates.PlayerTurn; * StartCoroutine(PlayerTurn()); * } * else if (!OnPlayerTurn) * { * states = BattleStates.Enemyturn; * StartCoroutine(EnemyTurn()); * }*/ }