Example #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);
    }