Ejemplo n.º 1
0
    // Token: 0x06002009 RID: 8201 RVA: 0x000993A8 File Offset: 0x000975A8
    public override void Shoot(Ray ray, out CmunePairList <BaseGameProp, ShotPoint> hits)
    {
        hits = null;
        Vector3    direction    = WeaponDataManager.ApplyDispersion(ray.direction, this._view, this._supportIronSight);
        int        projectileId = base.Controller.NextProjectileId();
        RaycastHit raycastHit;

        if (Physics.Raycast(ray.origin, direction, out raycastHit, 1000f, (!base.Controller.IsLocal) ? UberstrikeLayerMasks.ShootMaskRemotePlayer : UberstrikeLayerMasks.ShootMask))
        {
            HitPoint     point     = new HitPoint(raycastHit.point, TagUtil.GetTag(raycastHit.collider));
            BaseGameProp component = raycastHit.collider.GetComponent <BaseGameProp>();
            if (component)
            {
                hits = new CmunePairList <BaseGameProp, ShotPoint>(1);
                hits.Add(component, new ShotPoint(raycastHit.point, projectileId));
            }
            this.Decorator.PlayImpactSoundAt(point);
        }
        else
        {
            raycastHit.point = ray.origin + ray.direction * 1000f;
        }
        if (this.Decorator)
        {
            this.Decorator.ShowShootEffect(new RaycastHit[]
            {
                raycastHit
            });
        }
        base.OnHits(hits);
    }
    // Token: 0x0600200C RID: 8204 RVA: 0x000994D4 File Offset: 0x000976D4
    public override void Shoot(Ray ray, out CmunePairList <BaseGameProp, ShotPoint> hits)
    {
        Dictionary <BaseGameProp, ShotPoint> dictionary = new Dictionary <BaseGameProp, ShotPoint>(this.ShotgunGauge);
        HitPoint hitPoint = null;

        RaycastHit[] array        = new RaycastHit[this.ShotgunGauge];
        int          projectileId = base.Controller.NextProjectileId();
        int          num          = 1000;

        for (int i = 0; i < this.ShotgunGauge; i++)
        {
            Vector3    direction = WeaponDataManager.ApplyDispersion(ray.direction, this._view, false);
            RaycastHit raycastHit;
            if (Physics.Raycast(ray.origin, direction, out raycastHit, (float)num, (!base.Controller.IsLocal) ? UberstrikeLayerMasks.ShootMaskRemotePlayer : UberstrikeLayerMasks.ShootMask))
            {
                if (hitPoint == null)
                {
                    hitPoint = new HitPoint(raycastHit.point, TagUtil.GetTag(raycastHit.collider));
                }
                BaseGameProp component = raycastHit.collider.GetComponent <BaseGameProp>();
                if (component)
                {
                    ShotPoint shotPoint;
                    if (dictionary.TryGetValue(component, out shotPoint))
                    {
                        shotPoint.AddPoint(raycastHit.point);
                    }
                    else
                    {
                        dictionary.Add(component, new ShotPoint(raycastHit.point, projectileId));
                    }
                }
                array[i] = raycastHit;
            }
            else
            {
                array[i].point  = ray.origin + ray.direction * 1000f;
                array[i].normal = raycastHit.normal;
            }
        }
        this.Decorator.PlayImpactSoundAt(hitPoint);
        hits = new CmunePairList <BaseGameProp, ShotPoint>(dictionary.Count);
        foreach (KeyValuePair <BaseGameProp, ShotPoint> keyValuePair in dictionary)
        {
            hits.Add(keyValuePair.Key, keyValuePair.Value);
        }
        if (this.Decorator)
        {
            this.Decorator.ShowShootEffect(array);
        }
        base.OnHits(hits);
    }
Ejemplo n.º 3
0
    // Token: 0x06002010 RID: 8208 RVA: 0x000996D8 File Offset: 0x000978D8
    public override void Shoot(Ray ray, out CmunePairList <BaseGameProp, ShotPoint> hits)
    {
        Vector3 origin = ray.origin;

        origin.y  -= 0.1f;
        ray.origin = origin;
        hits       = null;
        float radius    = 1f;
        int   layerMask = (!base.Controller.IsLocal) ? UberstrikeLayerMasks.ShootMaskRemotePlayer : UberstrikeLayerMasks.ShootMask;
        float distance  = 1f;

        RaycastHit[] array        = Physics.SphereCastAll(ray, radius, distance, layerMask);
        int          projectileId = base.Controller.NextProjectileId();

        if (array != null && array.Length > 0)
        {
            hits = new CmunePairList <BaseGameProp, ShotPoint>();
            float      num = float.PositiveInfinity;
            RaycastHit hit = array[0];
            foreach (RaycastHit raycastHit in array)
            {
                Vector3 rhs = raycastHit.point - ray.origin;
                if (Vector3.Dot(ray.direction, rhs) > 0f && raycastHit.distance < num)
                {
                    num = raycastHit.distance;
                    hit = raycastHit;
                }
            }
            if (hit.collider)
            {
                BaseGameProp component = hit.collider.GetComponent <BaseGameProp>();
                if (component != null)
                {
                    hits.Add(component, new ShotPoint(hit.point, projectileId));
                }
                if (this._decorator)
                {
                    this._decorator.StartCoroutine(this.StartShowingEffect(hit, ray.origin, this.HitDelay));
                }
            }
        }
        else if (this._decorator)
        {
            this._decorator.ShowShootEffect(new RaycastHit[0]);
        }
        this.EmitWaterImpactParticles(ray, radius);
        base.OnHits(hits);
    }
Ejemplo n.º 4
0
 // Token: 0x0600202F RID: 8239 RVA: 0x00099BFC File Offset: 0x00097DFC
 public static void Explode(Vector3 position, int projectileId, float damage, Vector3 dir, float radius, int force, byte slot, int weaponId, UberstrikeItemClass weaponClass, DamageEffectType damageEffectFlag = DamageEffectType.None, float damageEffectValue = 0f)
 {
     Collider[] array = Physics.OverlapSphere(position, radius, UberstrikeLayerMasks.ExplosionMask);
     foreach (Collider collider in array)
     {
         BaseGameProp component = collider.transform.GetComponent <BaseGameProp>();
         if (component != null && component.RecieveProjectileDamage)
         {
             ProjectileDetonator.DoExplosionDamage(component, position, collider.bounds.center, projectileId, damage, dir, radius, force, slot, weaponId, weaponClass, damageEffectFlag, damageEffectValue);
         }
     }
     if (Vector3.Distance(position, GameState.Current.Player.transform.position) < radius)
     {
         ProjectileDetonator.DoExplosionDamage(GameState.Current.Player.Character, position, GameState.Current.Player.transform.position, projectileId, damage, dir, radius, force, slot, weaponId, weaponClass, damageEffectFlag, damageEffectValue);
     }
 }