IEnumerator EnemeyAttackRoutin(int attackRate) { while (_isEnemyDead == false) { yield return(new WaitForSeconds(attackRate)); if (_player.isPlayerDead == false) { _animator.SetTrigger("Attack1Trigger"); _player.TakeDame(_localUser.currentDefenderScore + 100);//Enemy Attach damage Rate } else { if (_isEnemyDead != true) { FightSet fightSet = new FightSet(_localUser.currentEventId, _localUser.userID, false, _localUser.currentMutex); StartCoroutine(_gameNetwork.SetFightSatus("https://harryspotter.eu.ngrok.io/setFightStatus", fightSet.Serialize().ToString())); _uIManagerFight.DisplayEndPanel(false);//player lost show panel break; } } print(_player.isPlayerDead); } }
private void TakeDame(int damge) { if (_enemyCurrentHealth > 0) { _enemyCurrentHealth = _enemyCurrentHealth - damge; _healthBar.SetHealth(_enemyCurrentHealth); } else { _enemyCurrentHealth = 0; _isEnemyDead = true; FightSet fightSet = new FightSet(_localUser.currentEventId, _localUser.userID, true, _localUser.currentMutex); StartCoroutine(_gameNetwork.SetFightSatus("https://harryspotter.eu.ngrok.io/setFightStatus", fightSet.Serialize().ToString())); _uIManagerFight.DisplayEndPanel(true);//player won show panel } }
public void OnExitButtonClick() { FightSet fightSet = new FightSet(_localUser.currentEventId, _localUser.userID, false, _localUser.currentMutex); StartCoroutine(_gameNetwork.SetFightSatus("https://harryspotter.eu.ngrok.io/setFightStatus", fightSet.Serialize().ToString())); SceneManager.LoadScene("Map"); }