Example #1
0
    // server-side
    public void HitPlayer(Transform aPlayer, float aWeight)
    {
        if (_isFinished)
        {
            return;
        }

        PlayerAvatar player = aPlayer.gameObject.GetComponent <PlayerAvatar>();

        if (!player.isAlive)
        {
            return;
        }

        player.DecreaseHealth(HEALTH_DECREASE_PER_SECOND * Time.deltaTime * aWeight);

        if (!player.isAlive)
        {
            player.respawn();
        }
    }