Exemplo n.º 1
0
    // Token: 0x0600111F RID: 4383 RVA: 0x00068354 File Offset: 0x00066554
    protected override void OnActivated()
    {
        Vector3    vector   = GameState.Current.PlayerData.ShootingPoint + GameState.Current.Player.EyePosition;
        Vector3    position = vector + GameState.Current.PlayerData.ShootingDirection * 2f;
        Vector3    velocity = GameState.Current.PlayerData.ShootingDirection * (float)this._config.Speed;
        float      distance = 2f;
        RaycastHit raycastHit;

        if (Physics.Raycast(vector, GameState.Current.PlayerData.ShootingDirection * 2f, out raycastHit, distance, UberstrikeLayerMasks.LocalRocketMask))
        {
            ExplosiveGrenadeQuickItem explosiveGrenadeQuickItem = this.Throw(raycastHit.point, Vector3.zero) as ExplosiveGrenadeQuickItem;
            explosiveGrenadeQuickItem.machine.PopAllStates();
            ExplosiveGrenadeQuickItem explosiveGrenadeQuickItem2 = explosiveGrenadeQuickItem;
            explosiveGrenadeQuickItem2.OnProjectileExploded = (Action <IGrenadeProjectile>) Delegate.Combine(explosiveGrenadeQuickItem2.OnProjectileExploded, new Action <IGrenadeProjectile>(delegate(IGrenadeProjectile p)
            {
                ProjectileDetonator.Explode(p.Position, p.ID, (float)this._config.Damage, Vector3.up, (float)this._config.SplashRadius, 5, 5, this.Configuration.ID, UberstrikeItemClass.WeaponLauncher, DamageEffectType.None, 0f);
            }));
            Singleton <ProjectileManager> .Instance.RemoveProjectile(explosiveGrenadeQuickItem.ID, true);

            GameState.Current.Actions.RemoveProjectile(explosiveGrenadeQuickItem.ID, true);
        }
        else
        {
            IGrenadeProjectile grenadeProjectile = this.Throw(position, velocity);
            grenadeProjectile.OnProjectileExploded += delegate(IGrenadeProjectile p)
            {
                ProjectileDetonator.Explode(p.Position, p.ID, (float)this._config.Damage, Vector3.up, (float)this._config.SplashRadius, 5, 5, this.Configuration.ID, UberstrikeItemClass.WeaponLauncher, DamageEffectType.None, 0f);
            };
        }
    }
Exemplo n.º 2
0
 // Token: 0x0600202E RID: 8238 RVA: 0x00099BAC File Offset: 0x00097DAC
 public void Explode(Vector3 position)
 {
     ProjectileDetonator.Explode(position, this.ProjectileID, this.Damage, this.Direction, this.Radius, this.Force, this.Slot, this.WeaponID, this.WeaponClass, this.DamageEffectFlag, this.DamageEffectValue);
 }
Exemplo n.º 3
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);
            };
        }
    }