void onRespawnFinished() { if (!_photonView.IsMine) { return; } _rb.simulated = true; cStatus = playerStatus.alive; InGameManager._inst.setCameraFollow(transform); UIOverlay.hide(EnumsData.UIOverlay.dead); UIInGameCanvas._inst.healthUpdate(currentHealth, maxHealth); }
void respawn() { if (!_photonView.IsMine) { return; } SoundManager._inst.stopSound(SoundEnum.WhileWaitForRespawn); cStatus = playerStatus.respawining; _animator.SetBool("Died", false); Transform point = NetworkPlayers._inst.getSpawnPoint(_thisPlayerTeam); currentHealth = maxHealth; _rb.simulated = false; Vector2 pos = new Vector3(point.position.x, point.position.y, transform.position.z); transform.DOMove(pos, .5f).OnComplete(() => { onRespawnFinished(); }).Play(); healthBar.setHealth(this.currentHealth, maxHealth); }
public void onDeath() { if (_thisPlayerTeam == Team.Doctors) { SoundManager._inst.playSoundOnceAt(SoundEnum.DoctorDie, transform.position); } else { SoundManager._inst.playSoundOnceAt(SoundEnum.PatientDie, transform.position); } if (!_photonView.IsMine) { return; } _animator.SetBool("Died", true); deathCount++; SoundManager._inst.playSoundOnce(SoundEnum.WhileWaitForRespawn); cStatus = playerStatus.dead; respawnTimer = respawnTime; UIOverlay.show(EnumsData.UIOverlay.dead); InGameManager._inst.setDeadFollowNexT(); UIInGameCanvas._inst.setLocalPlayerStats(killsOnPlayersCount, killsOnBotCount, deathCount); }