Player.RpcTakeDamage C# (CSharp) Method

RpcTakeDamage() private method

private RpcTakeDamage ( int _amount, string _sourceID ) : void
_amount int
_sourceID string
return void
    public void RpcTakeDamage(int _amount, string _sourceID)
    {
        if (isDead)
            return;

        currentHealth -= _amount;

        Debug.Log(transform.name + " now has " + currentHealth + " health.");

        if (currentHealth <= 0)
        {
            Die(_sourceID);
        }
    }

Usage Example

示例#1
0
    void CmdPlayerShot(string _playerID, int _damage, string _sourcePlayerID)
    {
        Debug.Log(_playerID + " has been shot.");

        Player _player = GameManager.GetPlayer(_playerID);

        _player.RpcTakeDamage(_damage, _sourcePlayerID);
    }
All Usage Examples Of Player::RpcTakeDamage