/// <summary> /// The take damage. /// </summary> /// <param name="amount"> /// The amount. /// </param> public void TakeDamage(float amount) { if (!this.isServer || this.health <= 0) { return; } if (NetworkGameManager.PlayersGetCount() == 1) { return; } this.health -= amount; this.GetComponent <Commands>().CmdHealthUpdate(this.health); if (this.health <= 0) { this.health = 0; if (NetworkGameManager.RemoveAndCheckForWin(this)) { this.StartCoroutine(this.GoToLobby()); } } }
/// <summary> /// The start. /// </summary> private void Start() { if (this.isServer) { NetworkGameManager.AddToList(this.gameObject.GetComponent <NetworkPlayer>()); } if (this.isLocalPlayer) { this.GetComponent <NetworkAnimator>().SetParameterAutoSend(0, true); this.syncarmRotation = Quaternion.identity; this.pname = RegisterPlayer.Self.PlayerName; } if (!this.isServer) { this.CmdChangeName(this.pname); } }