Example #1
0
    // Token: 0x06002030 RID: 8240 RVA: 0x00099CDC File Offset: 0x00097EDC
    private static void DoExplosionDamage(IShootable shootable, Vector3 explosionPoint, Vector3 hitPoint, int projectileId, float damage, Vector3 dir, float radius, int force, byte slot, int weaponId, UberstrikeItemClass weaponClass, DamageEffectType damageEffectFlag, float damageEffectValue)
    {
        RaycastHit raycastHit;

        if (!Physics.Linecast(explosionPoint, hitPoint, out raycastHit, UberstrikeLayerMasks.ProtectionMask) || raycastHit.transform == shootable.Transform || raycastHit.transform.GetComponent <BaseGameProp>() != null)
        {
            float   num    = (radius <= 1f) ? 0f : Mathf.Floor(Mathf.Clamp((hitPoint - explosionPoint).magnitude, 0f, radius));
            Vector3 vector = (hitPoint - explosionPoint).normalized;
            if (num < 0.01f)
            {
                vector = dir.normalized;
            }
            else if (Vector3.Angle(vector, Vector3.up) < 30f)
            {
                vector = Vector3.up;
                num    = 0f;
            }
            short   num2    = Convert.ToInt16(damage * (radius - num) / radius);
            Vector3 vector2 = vector;
            if (shootable.IsLocal)
            {
                vector2 *= (float)force;
                num2    /= 2;
            }
            shootable.ApplyDamage(new DamageInfo(num2)
            {
                Force = vector2,
                UpwardsForceMultiplier = 5f,
                Hitpoint          = hitPoint,
                ProjectileID      = projectileId,
                SlotId            = slot,
                WeaponID          = weaponId,
                WeaponClass       = weaponClass,
                DamageEffectFlag  = damageEffectFlag,
                DamageEffectValue = damageEffectValue,
                Distance          = (byte)Mathf.Clamp(Mathf.CeilToInt(num), 0, 255)
            });
        }
    }