DeclareHitToOthers() public method

public DeclareHitToOthers ( int damage, Vector3 point, PlayerPresence instigator ) : void
damage int
point Vector3
instigator PlayerPresence
return void
Example #1
0
    bool DoDamageTo(Transform t, Vector3 point)
    {
        HealthScript health = t.GetComponentInParent <HealthScript>();

        // err, kinda lame, this is so that the collider can be
        // directly inside the damaged object rather than on it,
        // useful when the damage collider is different from the
        // real collider

        // Don't do anything if we aren't dealing any damage
        if (damage > 0 && health != null)
        {
            if (health.PlayerScript.Possessor != Instigator &&        // No Friendly Fire
                uLink.Network.player == Instigator.networkView.owner) // only do damage from net player that fired
            {
                GetComponent <AudioSource>().Play();                  //Hitreg Sound
                health.DeclareHitToOthers(damage, point, Instigator);
                return(true);
            }
        }

        return(false);
    }