Exemplo n.º 1
0
    public HitInfo GetHitInfo(float dist, Vector3 dir)
    {
        HitInfo info = gunInfo.hitInfo.Clone();

        if (dist > gunInfo.falloffRange)
        {
            if (gunInfo.compoundFalloff)
            {
                float falloff = Mathf.Pow((1f - gunInfo.falloffAmount), Mathf.Floor(dist - gunInfo.falloffRange));
                info.enemyHealthDelta    *= falloff;
                info.enemyKnockback      *= falloff;
                info.teammateHealthDelta *= falloff;
                info.teammateKnockback   *= falloff;
            }
            else
            {
                float falloff = (1f - gunInfo.falloffAmount);
                info.enemyHealthDelta    *= falloff;
                info.enemyKnockback      *= falloff;
                info.teammateHealthDelta *= falloff;
                info.teammateKnockback   *= falloff;
            }
        }

        info.SetId(GetComponent <PhotonView>().ViewID);
        info.SetTeam((Team)PhotonNetwork.LocalPlayer.CustomProperties["team"]);
        info.SetDirection(dir);

        return(info);
    }