// Token: 0x06002040 RID: 8256 RVA: 0x00099FCC File Offset: 0x000981CC
 public Projectile EmitProjectile(Ray ray, int projectileID, int cmid)
 {
     if (this._decorator && this._decorator.Missle)
     {
         Vector3    muzzlePosition = this._decorator.MuzzlePosition;
         Quaternion rotation       = Quaternion.LookRotation(ray.direction);
         Projectile projectile     = UnityEngine.Object.Instantiate(this._decorator.Missle, muzzlePosition, rotation) as Projectile;
         if (projectile)
         {
             if (projectile is GrenadeProjectile)
             {
                 GrenadeProjectile grenadeProjectile = projectile as GrenadeProjectile;
                 grenadeProjectile.Sticky = base.Config.Sticky;
             }
             projectile.transform.parent = ProjectileManager.Container.transform;
             projectile.gameObject.tag   = "Prop";
             projectile.ExplosionEffect  = this.ExplosionType;
             projectile.TimeOut          = this._decorator.MissileTimeOut;
             projectile.SetExplosionSound(this._decorator.ExplosionSound);
             projectile.transform.position = ray.origin + (float)this.MinProjectileDistance * ray.direction;
             if (base.Controller.IsLocal)
             {
                 projectile.gameObject.layer = 26;
             }
             else
             {
                 projectile.gameObject.layer = 24;
             }
             CharacterConfig characterConfig;
             if (GameState.Current != null && GameState.Current.TryGetPlayerAvatar(cmid, out characterConfig) && characterConfig.Avatar.Decorator && projectile.gameObject.activeSelf)
             {
                 foreach (CharacterHitArea characterHitArea in characterConfig.Avatar.Decorator.HitAreas)
                 {
                     if (characterHitArea.gameObject.activeInHierarchy)
                     {
                         Physics.IgnoreCollision(projectile.gameObject.collider, characterHitArea.collider);
                     }
                 }
             }
             projectile.MoveInDirection(ray.direction * WeaponConfigurationHelper.GetProjectileSpeed(this._view));
             return(projectile);
         }
     }
     return(null);
 }
Exemplo n.º 2
0
    // Token: 0x060009B5 RID: 2485 RVA: 0x0003D888 File Offset: 0x0003BA88
    public void SetItem(IUnityItem item, Rect bounds, PopupViewSide side, int daysLeft = -1, BuyingDurationType duration = BuyingDurationType.None)
    {
        if (Event.current.type != EventType.Repaint || item == null || Singleton <ItemManager> .Instance.IsDefaultGearItem(item.View.PrefabName) || (item.View.LevelLock > PlayerDataManager.PlayerLevel && !Singleton <InventoryManager> .Instance.Contains(item.View.ID)))
        {
            return;
        }
        bool flag = this._alpha < Time.time + 0.1f;

        this._alpha = Mathf.Lerp(this._alpha, Time.time + 1.1f, Time.deltaTime * 12f);
        if (this._item != item || this._cacheRect != bounds || !this.IsEnabled)
        {
            this._cacheRect   = bounds;
            bounds            = GUITools.ToGlobal(bounds);
            this.IsEnabled    = true;
            this._item        = item;
            this._level       = ((item.View == null) ? 0 : item.View.LevelLock);
            this._description = ((item.View == null) ? string.Empty : item.View.Description);
            this._daysLeft    = daysLeft;
            this._criticalHit = 0;
            this._duration    = duration;
            switch (side)
            {
            case PopupViewSide.Left:
            {
                float tipPosition = bounds.y - 10f + bounds.height * 0.5f;
                Rect  rect        = new Rect(bounds.x - this.Size.x - 9f, bounds.y - this.Size.y * 0.5f, this.Size.x, this.Size.y);
                Rect  rect2       = new Rect(rect.xMax - 1f, tipPosition, 12f, 21f);
                if (rect.y <= (float)GlobalUIRibbon.Instance.Height())
                {
                    rect.y += (float)GlobalUIRibbon.Instance.Height() - rect.y;
                }
                if (rect.yMax >= (float)Screen.height)
                {
                    rect.y -= rect.yMax - (float)Screen.height;
                }
                if (rect2.y < this._finalRect.y || rect2.yMax > this._finalRect.yMax || this._finalRect.x != rect.x)
                {
                    this._finalRect = rect;
                    if (flag)
                    {
                        this._rect = rect;
                    }
                }
                this.OnDrawTip = delegate()
                {
                    GUI.DrawTexture(new Rect(this._rect.xMax - 1f, tipPosition, 12f, 21f), ConsumableHudTextures.TooltipRight);
                };
                break;
            }

            case PopupViewSide.Top:
            {
                float tipPosition = bounds.x - 10f + bounds.width * 0.5f;
                Rect  rect3       = new Rect(bounds.x + (bounds.width - this.Size.x) * 0.5f, bounds.y - this.Size.y - 9f, this.Size.x, this.Size.y);
                Rect  rect4       = new Rect(tipPosition, rect3.yMax - 1f, 21f, 12f);
                if (rect3.xMin <= 10f)
                {
                    rect3.x = 10f;
                }
                if (rect3.xMax >= (float)(Screen.width - 10))
                {
                    rect3.x -= rect3.xMax - (float)Screen.width + 10f;
                }
                if (rect4.x < this._finalRect.x || rect4.xMax > this._finalRect.xMax || this._finalRect.y != rect3.y)
                {
                    this._finalRect = rect3;
                    if (flag)
                    {
                        this._rect = rect3;
                    }
                }
                this.OnDrawTip = delegate()
                {
                    GUI.DrawTexture(new Rect(tipPosition, this._rect.yMax - 1f, 21f, 12f), ConsumableHudTextures.TooltipDown);
                };
                break;
            }
            }
            switch (item.View.ItemClass)
            {
            case UberstrikeItemClass.WeaponMelee:
            {
                this.OnDrawItemDetails = new Action(this.DrawMeleeWeapon);
                UberStrikeItemWeaponView uberStrikeItemWeaponView = item.View as UberStrikeItemWeaponView;
                if (uberStrikeItemWeaponView != null)
                {
                    this._damage.Value   = WeaponConfigurationHelper.GetDamage(uberStrikeItemWeaponView);
                    this._damage.Max     = WeaponConfigurationHelper.MaxDamage;
                    this._fireRate.Value = WeaponConfigurationHelper.GetRateOfFire(uberStrikeItemWeaponView);
                    this._fireRate.Max   = WeaponConfigurationHelper.MaxRateOfFire;
                }
                return;
            }

            case UberstrikeItemClass.WeaponMachinegun:
            case UberstrikeItemClass.WeaponShotgun:
            case UberstrikeItemClass.WeaponSniperRifle:
            {
                this.OnDrawItemDetails = new Action(this.DrawInstantHitWeapon);
                UberStrikeItemWeaponView uberStrikeItemWeaponView2 = item.View as UberStrikeItemWeaponView;
                if (uberStrikeItemWeaponView2 != null)
                {
                    this._ammo.Value     = WeaponConfigurationHelper.GetAmmo(uberStrikeItemWeaponView2);
                    this._ammo.Max       = WeaponConfigurationHelper.MaxAmmo;
                    this._damage.Value   = WeaponConfigurationHelper.GetDamage(uberStrikeItemWeaponView2);
                    this._damage.Max     = WeaponConfigurationHelper.MaxDamage;
                    this._fireRate.Value = WeaponConfigurationHelper.GetRateOfFire(uberStrikeItemWeaponView2);
                    this._fireRate.Max   = WeaponConfigurationHelper.MaxRateOfFire;
                    this._accuracy.Value = WeaponConfigurationHelper.MaxAccuracySpread - WeaponConfigurationHelper.GetAccuracySpread(uberStrikeItemWeaponView2);
                    this._accuracy.Max   = WeaponConfigurationHelper.MaxAccuracySpread;
                    //_armorPierced.Value = WeaponConfigurationHelper.GetArmorPierced(uberStrikeItemWeaponView2);
                    //_armorPierced.Max = WeaponConfigurationHelper.MaxArmorPierced;

                    if (item.View.ItemProperties.ContainsKey(ItemPropertyType.CritDamageBonus))
                    {
                        this._criticalHit = item.View.ItemProperties[ItemPropertyType.CritDamageBonus];
                    }
                    else
                    {
                        this._criticalHit = 0;
                    }
                }
                return;
            }

            case UberstrikeItemClass.WeaponCannon:
            case UberstrikeItemClass.WeaponSplattergun:
            case UberstrikeItemClass.WeaponLauncher:
            {
                this.OnDrawItemDetails = new Action(this.DrawProjectileWeapon);
                UberStrikeItemWeaponView uberStrikeItemWeaponView3 = item.View as UberStrikeItemWeaponView;
                if (uberStrikeItemWeaponView3 != null)
                {
                    this._ammo.Value         = WeaponConfigurationHelper.GetAmmo(uberStrikeItemWeaponView3);
                    this._ammo.Max           = WeaponConfigurationHelper.MaxAmmo;
                    this._damage.Value       = WeaponConfigurationHelper.GetDamage(uberStrikeItemWeaponView3);
                    this._damage.Max         = WeaponConfigurationHelper.MaxDamage;
                    this._fireRate.Value     = WeaponConfigurationHelper.GetRateOfFire(uberStrikeItemWeaponView3);
                    this._fireRate.Max       = WeaponConfigurationHelper.MaxRateOfFire;
                    this._velocity.Value     = WeaponConfigurationHelper.GetProjectileSpeed(uberStrikeItemWeaponView3);
                    this._velocity.Max       = WeaponConfigurationHelper.MaxProjectileSpeed;
                    this._damageRadius.Value = WeaponConfigurationHelper.GetSplashRadius(uberStrikeItemWeaponView3);
                    this._damageRadius.Max   = WeaponConfigurationHelper.MaxSplashRadius;
                }
                return;
            }

            case UberstrikeItemClass.GearBoots:
            case UberstrikeItemClass.GearHead:
            case UberstrikeItemClass.GearFace:
            case UberstrikeItemClass.GearUpperBody:
            case UberstrikeItemClass.GearLowerBody:
            case UberstrikeItemClass.GearGloves:
            case UberstrikeItemClass.GearHolo:
                this.OnDrawItemDetails   = new Action(this.DrawGear);
                this._armorCarried.Value = (float)((UberStrikeItemGearView)item.View).ArmorPoints;
                this._armorCarried.Max   = 200f;
                return;

            case UberstrikeItemClass.QuickUseGeneral:
            case UberstrikeItemClass.QuickUseGrenade:
            case UberstrikeItemClass.QuickUseMine:
                this.OnDrawItemDetails = new Action(this.DrawQuickItem);
                return;
            }
            this.OnDrawItemDetails = null;
        }
    }