Exemplo n.º 1
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.º 2
0
    // Token: 0x06001F9A RID: 8090 RVA: 0x000979E8 File Offset: 0x00095BE8
    private void AddGameLogicToWeapon(WeaponSlot weapon)
    {
        float movement = WeaponConfigurationHelper.GetRecoilMovement(weapon.View);
        float kickback = WeaponConfigurationHelper.GetRecoilKickback(weapon.View);
        global::LoadoutSlotType slot = weapon.Slot;

        if (weapon.Logic is ProjectileWeapon)
        {
            ProjectileWeapon w = weapon.Logic as ProjectileWeapon;
            w.OnProjectileShoot += delegate(ProjectileInfo p)
            {
                ProjectileDetonator projectileDetonator = new ProjectileDetonator(WeaponConfigurationHelper.GetSplashRadius(weapon.View), (float)weapon.View.DamagePerProjectile, weapon.View.DamageKnockback, p.Direction, weapon.SlotId, p.Id, weapon.View.ID, weapon.View.ItemClass, w.Config.DamageEffectFlag, w.Config.DamageEffectValue);
                if (p.Projectile != null)
                {
                    p.Projectile.Detonator = projectileDetonator;
                    if (weapon.View.ItemClass != UberstrikeItemClass.WeaponSplattergun)
                    {
                        GameState.Current.Actions.EmitProjectile(p.Position, p.Direction, slot, p.Id, false);
                    }
                }
                else
                {
                    projectileDetonator.Explode(p.Position);
                    if (weapon.View.ItemClass != UberstrikeItemClass.WeaponSplattergun)
                    {
                        GameState.Current.Actions.EmitProjectile(p.Position, p.Direction, slot, p.Id, true);
                    }
                }
                if (weapon.View.ItemClass != UberstrikeItemClass.WeaponSplattergun)
                {
                    if (w.HasProjectileLimit)
                    {
                        Singleton <ProjectileManager> .Instance.AddLimitedProjectile(p.Projectile, p.Id, w.MaxConcurrentProjectiles);
                    }
                    else
                    {
                        Singleton <ProjectileManager> .Instance.AddProjectile(p.Projectile, p.Id);
                    }
                }
                LevelCamera.DoFeedback(LevelCamera.FeedbackType.ShootWeapon, Vector3.back, 0f, movement / 8f, 0.1f, 0.3f, kickback / 3f, Vector3.left);
            };
        }
        else if (weapon.Logic is MeleeWeapon)
        {
            float delay = weapon.Logic.HitDelay;
            weapon.Logic.OnTargetHit += delegate(CmunePairList <BaseGameProp, ShotPoint> h)
            {
                if (!weapon.View.HasAutomaticFire)
                {
                    GameState.Current.Actions.SingleBulletFire();
                }
                if (h != null)
                {
                    UnityRuntime.StartRoutine(this.StartApplyDamage(weapon, delay, h));
                }
                LevelCamera.DoFeedback(LevelCamera.FeedbackType.ShootWeapon, Vector3.back, 0f, movement / 8f, 0.1f, 0.3f, kickback / 3f, Vector3.left);
            };
        }
        else
        {
            weapon.Logic.OnTargetHit += delegate(CmunePairList <BaseGameProp, ShotPoint> h)
            {
                if (!weapon.View.HasAutomaticFire)
                {
                    GameState.Current.Actions.SingleBulletFire();
                }
                if (h != null)
                {
                    this.ApplyDamage(weapon, h);
                }
                LevelCamera.DoFeedback(LevelCamera.FeedbackType.ShootWeapon, Vector3.back, 0f, movement / 8f, 0.1f, 0.3f, kickback / 3f, Vector3.left);
            };
        }
    }