예제 #1
0
    public void CmdApplyDamage(HitManager.HitVerificationMethod ver, HitArguments hit)
    {
        //print("applying damage");
        PlayerStats targetStats;

        if (hit.sourcePlayerTeam != -1 && (targetStats = hit.target.GetComponentInParent <PlayerStats>()))
        {
            if (targetStats.teamIndex == this.teamIndex && !hit.hitSameTeam)
            {
                Debug.LogWarning("Same team, not registering hit on target " + hit.target);
                return;
            }
        }
        if (HitManager.VerifyHit(ver, hit) && hit.target != null && hit.target.GetComponentInParent <IHittable>() != null)
        {
            hit.target.GetComponentInParent <IHittable>().Hit(hit);
            if (hit.target.GetComponentInParent <PlayerStats>() && hit.target != this.gameObject)
            {
                RpcConfirmHit(hit.damage);
            }
        }
    }