Exemplo n.º 1
0
    // Token: 0x06001F7B RID: 8059 RVA: 0x000970A4 File Offset: 0x000952A4
    public bool Shoot()
    {
        bool result = false;

        if (this.IsWeaponReady)
        {
            if (this.CheckAmmoCount())
            {
                this._currentSlot.InputHandler.FireHandler.RegisterShot();
                if (!GameFlags.IsFlagSet(GameFlags.GAME_FLAGS.QuickSwitch, GameState.Current.RoomData.GameFlags))
                {
                    this._holsterTime = WeaponConfigurationHelper.GetRateOfFire(this._currentSlot.View);
                }
                Ray ray = new Ray(GameState.Current.PlayerData.ShootingPoint + GameState.Current.Player.EyePosition, GameState.Current.PlayerData.ShootingDirection);
                CmunePairList <BaseGameProp, ShotPoint> cmunePairList;
                this._currentSlot.Logic.Shoot(ray, out cmunePairList);
                if (!this._currentSlot.Decorator.HasShootAnimation)
                {
                    WeaponFeedbackManager.Instance.Fire();
                }
                AmmoDepot.UseAmmoOfClass(this._currentSlot.View.ItemClass, this._currentSlot.Logic.AmmoCountPerShot);
                GameState.Current.PlayerData.WeaponFired.Value = this._currentSlot;
                result = true;
            }
            else
            {
                this._currentSlot.Decorator.PlayOutOfAmmoSound();
                GameData.Instance.OnNotificationFull.Fire(string.Empty, "Out of ammo!", 1f);
            }
        }
        return(result);
    }
 // Token: 0x0600204B RID: 8267 RVA: 0x0009A550 File Offset: 0x00098750
 public void Shoot(ICharacterState state)
 {
     if (state != null && this._nextShootTime < Time.time && this._currentSlot != null && (!(this._currentSlot.Logic is ProjectileWeapon) || this._currentSlot.View.ItemClass == UberstrikeItemClass.WeaponSplattergun))
     {
         this._nextShootTime = Time.time + WeaponConfigurationHelper.GetRateOfFire(this._currentSlot.View);
         this.BeginShooting();
         CmunePairList <BaseGameProp, ShotPoint> cmunePairList;
         this._currentSlot.Logic.Shoot(new Ray(this.ShootingPoint(state) + GameState.Current.Player.EyePosition, this.ShootingDirection(state)), out cmunePairList);
         this.EndShooting();
     }
 }
 // Token: 0x06001F11 RID: 7953 RVA: 0x00095EA0 File Offset: 0x000940A0
 public SniperRifleInputHandler(IWeaponLogic logic, bool isLocal, ZoomInfo zoomInfo, UberStrikeItemWeaponView view) : base(logic, isLocal)
 {
     this._zoomInfo = zoomInfo;
     if (view.HasAutomaticFire)
     {
         base.FireHandler = new FullAutoFireHandler(logic.Decorator, WeaponConfigurationHelper.GetRateOfFire(view));
     }
     else
     {
         base.FireHandler = new SemiAutoFireHandler(logic.Decorator, WeaponConfigurationHelper.GetRateOfFire(view));
     }
 }
 // Token: 0x06001EF8 RID: 7928 RVA: 0x00095E44 File Offset: 0x00094044
 public DefaultWeaponInputHandler(IWeaponLogic logic, bool isLocal, UberStrikeItemWeaponView view, IWeaponFireHandler secondaryFireHandler = null) : base(logic, isLocal)
 {
     if (view.HasAutomaticFire)
     {
         base.FireHandler = new FullAutoFireHandler(logic.Decorator, WeaponConfigurationHelper.GetRateOfFire(view));
     }
     else
     {
         base.FireHandler = new SemiAutoFireHandler(logic.Decorator, WeaponConfigurationHelper.GetRateOfFire(view));
     }
     this._secondaryFireHandler = secondaryFireHandler;
 }
Exemplo n.º 5
0
 // Token: 0x06001FBA RID: 8122 RVA: 0x000984FC File Offset: 0x000966FC
 public void PickUp(WeaponSlot slot)
 {
     if (this._pickupWeaponState != null && this._pickupWeaponState.IsValid)
     {
         if (this._pickupWeaponState.Weapon == slot.Logic)
         {
             return;
         }
         this.PutDownWeapon(this._pickupWeaponState.Weapon, this._pickupWeaponState.Decorator, false);
     }
     else if (this._pickupWeaponState == null && this._putDownWeaponState != null && this._putDownWeaponState.Weapon == slot.Logic)
     {
         this._putDownWeaponState.Finish();
     }
     this._pickupWeaponState    = new WeaponFeedbackManager.PickUpState(slot.Logic, slot.Decorator);
     this.WeaponFire.recoilTime = WeaponConfigurationHelper.GetRateOfFire(slot.View);
     this.WeaponFire.strength   = WeaponConfigurationHelper.GetRecoilMovement(slot.View);
     this.WeaponFire.angle      = WeaponConfigurationHelper.GetRecoilKickback(slot.View);
 }
Exemplo n.º 6
0
 // Token: 0x06001F09 RID: 7945 RVA: 0x000147D9 File Offset: 0x000129D9
 public MinigunInputHandler(IWeaponLogic logic, bool isLocal, MinigunWeaponDecorator weapon, UberStrikeItemWeaponView view) : base(logic, isLocal)
 {
     this._weapon     = weapon;
     base.FireHandler = new FullAutoFireHandler(weapon, WeaponConfigurationHelper.GetRateOfFire(view));
 }
Exemplo n.º 7
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;
        }
    }