private RpcTakeDamage ( int _amount, string _sourceID ) : void | ||
_amount | int | |
_sourceID | string | |
Résultat | void |
void CmdPlayerShot(string _playerID, int _damage, string _sourcePlayerID) { Debug.Log(_playerID + " has been shot."); Player _player = GameManager.GetPlayer(_playerID); _player.RpcTakeDamage(_damage, _sourcePlayerID); }
void CmdPlayerHit(string _playerID, int _damage) { Debug.Log(_playerID + " has been hit"); Player _player = GameManager.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); }
private void CmdPlayerShot(string playerId, float damage, string sourceID) { Debug.Log(playerId + " a été touché."); Player player = GameManager.GetPlayer(playerId); player.RpcTakeDamage(damage, sourceID); }
void CmdPlayerShot(string _playerID, int damage) { Debug.Log($"{_playerID} has been shot"); Player player = GameManager.GetPlayer(_playerID); player.RpcTakeDamage(damage); }
void CmdPlayerShot(string playerID, float damage) { Debug.Log(playerID + " has been shot."); Player player = GameManager.GetPlayer(playerID); player.RpcTakeDamage(damage); }
private void CmdPlayerShot(string playerId, int damage) { Debug.Log(playerId + " has been shot!"); Player player = GameManager.GetPlayer(playerId); player.RpcTakeDamage(damage); }
public void CmdPlayerShot(string playerID, float damage) { Player playerShot = GameManager.GetPlayer(playerID); if (playerShot != this.player) { playerShot.RpcTakeDamage(damage); } }
[Command] // A Command is a method called from a client that is executed on the server void CmdPlayerShot(string _playerID, int _damage, string _sourceID) { Player _player = GameManager.GetPlayer(_playerID); Player _source = GameManager.GetPlayer(_sourceID); Debug.Log(_source.username + " shot " + _player.username); _player.RpcTakeDamage(_damage, _sourceID); }
public void CmdPlayerShot(string _playerID, float _damage) { UnityEngine.Debug.Log(_playerID + " has been shot"); Player _player = GameManager1.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); Destroy(this.gameObject); }
void CmdPlayerShot(string _PlayerID, int _damage) { // Let the server know that a player's been shot. // Lets find out what player has been shot using the GameManger GetPlayer method. Player _player = GameManager.GetPlayer(_PlayerID); // Now, lets damage the player. ¬‿¬ _player.RpcTakeDamage(_damage); }
void CmdPlayerShot(string _playerID, int _damage) { Debug.Log(_playerID + " has been shot."); Player _player = GameManage.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); //GameObject.Find(_ID); }
void CmdPlayerShot(string _playerID, int _damage) { Player _player = GameManager.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); Debug.Log(_playerID + " has been shot."); int debugPlayerHitHealth = _player.GetCurrentHealth(); Debug.Log(_playerID + " has now " + debugPlayerHitHealth.ToString()); }
[Command] //This method is only called on the server void CmdPlayerShot(string playerID, int _damage, string _sourceID) { Debug.Log(playerID + " has been shot."); //it will show which element has been shot //Destroy (GameObject.Find(ID)); //Finds and destroys the object found by ID, but is disabled because is slow, could be applied later or in another game Player _player = GameManager.GetPlayer(playerID); _player.RpcTakeDamage(_damage, _sourceID); }
private void OnCollisionEnter(Collision collision) { if (collision.collider.GetComponent <Player>()) { Player playerCollision = collision.collider.GetComponent <Player>(); if (rb.velocity.magnitude >= 25) { playerCollision.RpcTakeDamage((int)rb.velocity.magnitude, this.gameObject.name); } } }
public void PlayerShot(string _playerID, int _damage, string nameTag, bool _headshot) { print("SHOULDNT BE HERE"); Player _player = GameManager.GetPlayer(_playerID); if (!isServer && isClient) { CmdPlayerShot(_playerID, _damage, nameTag, _headshot); return; } _player.RpcTakeDamage(_damage, nameTag, _headshot); }
void CmdPlayerShot(string _playerID, int _damage) { Debug.Log(_playerID + "has been shot."); Player _player = GameManager.GetPlayer(_playerID); if (gameObject.GetComponent <Player> ().Team == _player.Team) // same team { return; } _player.RpcTakeDamage(_damage); }
void RpcAiAttackPlayer(string name) { Player player = GameManager.GetPlayer(name); if (player.currentHealth <= 0) { focused_player = null; moveToPlayer = false; } else if (ai_obj.currentHealth > 0) { player.RpcTakeDamage(10, player.name); } }
private IEnumerator LavaChecker() { while (true) { yield return(new WaitForSeconds(0.5f)); var collidersInBounds = Physics.OverlapSphere(transform.position, 0.6f); var isSafe = collidersInBounds.Any(col => col.isTrigger && (col.tag == "Safe" || col.tag == "Column")); if (!isSafe) { _player.RpcTakeDamage(_damagePerTick, null, "Lava"); } } }
void CmdPlayerShoot(string _id, int damage) { try { //comand for server Debug.Log(_id + " - has been shoot!"); Player player = GameManager.GetPlayer(_id); player.RpcTakeDamage(damage); } catch (Exception e) { Debug.Log("Exception is script PlayerShoot at methods C_PlayerShoot!" + e.Message); } }
void CmdPlayerShot(string playerId, int damage, GameObject p) { Debug.Log(playerId + "has been shot"); Player player = GameManager1.GetPlayer(playerId); player.RpcTakeDamage(damage, p); //NetworkServer.Destroy(p); // NetworkTransformChild.Destroy(p); // player.RpcTakeDamage(damage); }
void CmdPlayerShot(string _playerID, int _damage) { Debug.Log(_playerID + " has been shot"); Player _player = GameManager.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); if (_player.lost) { if (_player.name == "Player 1") { Debug.Log(_player.name + " has Lost"); Debug.Log("Player 2 has Won"); string idd = "Player 2"; Player _player1 = GameManager.GetPlayer(idd); _player.EndGame(); _player1.EndGame(); } else { Debug.Log(_player.name + " has Lost"); Debug.Log("Player 1 has Won"); string idd = "Player 1"; Player _player1 = GameManager.GetPlayer(idd); _player.EndGame(); _player1.EndGame(); } } else if (_player.isDead) { if (_player.name == "Player 1") { string idd = "Player 2"; Player _player1 = GameManager.GetPlayer(idd); _player1.kills++; } else { string idd = "Player 1"; Player _player1 = GameManager.GetPlayer(idd); _player1.kills++; } } }
void OnCollisionEnter(Collision col) { if (col.collider.gameObject.layer != LayerMask.NameToLayer("Bullets") && col.collider.gameObject.layer != LayerMask.NameToLayer("LocalPlayer")) { if (col.collider.gameObject.layer == LayerMask.NameToLayer("RemotePlayer")) { Player _player = GameManager.GetPlayer(col.transform.name); _player.RpcTakeDamage(weapon.damage, sourceID); } foreach (ContactPoint contact in col.contacts) { shoot.CmdOnHit(contact.point, contact.normal); } Debug.Log(col.transform.name); Destroy(gameObject); } }
void OnTriggerEnter2D(Collider2D other) { string collLayerName = LayerMask.LayerToName(other.gameObject.layer); if (collLayerName == "Player") { if (!canHitPlayer) { return; } if (isServer) { Player p = other.GetComponent <Player>(); if (p.hasKey) { p.dropKey(); } p.RpcTakeDamage(damageAmount); } } else if (collLayerName == "Ground") { Vector2 currentPosition2D = (Vector2)(transform.position); int layer_mask = LayerMask.GetMask("Ground"); RaycastHit2D hit = Physics2D.Raycast(currentPosition2D, currentPosition2D + rb.velocity, 10f, layer_mask); Transform stoneBrPart = (Transform)Instantiate(stoneBreakParticlesPrefab, hit.point, Quaternion.FromToRotation(Vector3.right, hit.normal)); Destroy(stoneBrPart.gameObject, 1f); } //once collided, keep it for Stone transform to correctly be sent to lagging clients. //Stone is destroyed by server after 5s transform.GetComponent <SpriteRenderer>().enabled = false; transform.GetComponent <CircleCollider2D>().enabled = false; }
void CmdPlayerWasShot(string _playerID, int _damage) { Player _player = GameManager.GetPlayer(_playerID); _player.RpcTakeDamage(_damage); }
void CmdPlayerShot(string playerID, int weaponDamage) { Player shotedPlayer = GameManager.getPlayer(playerID); shotedPlayer.RpcTakeDamage(weaponDamage); }
void CmdPlayerShot(string _playerID, int _damage, string _sourceID) { Player _player = GameManager.GetPlayer(_playerID); _player.RpcTakeDamage(_damage, _sourceID); }
void CmdPlayerShot(GameObject obj, string _playerID, int damage) { Player player = GameManager.GetPlayer(_playerID.Replace("Player ", "")); player.RpcTakeDamage(obj, damage); }
void CmdPlayerShot(string playerID, int damage) { Player player = GameManager.GetPlayer(playerID); //find player that gets damage player.RpcTakeDamage(damage); //taking damage from shooting }
void CmdPlayerShot(uint netId, int damage) { Player player = GameManager.GetPlayer(netId); player.RpcTakeDamage(damage); }
protected virtual void PlayerHit(string _ID, int _damage, string _attackerID) { Player _player = GameManager.GetPlayer(_ID); _player.RpcTakeDamage(_damage, _attackerID); }