Exemplo n.º 1
0
    // Token: 0x0600118D RID: 4493 RVA: 0x000693EC File Offset: 0x000675EC
    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))
        {
            SpringGrenadeQuickItem springGrenadeQuickItem = this.Throw(raycastHit.point, Vector3.zero) as SpringGrenadeQuickItem;
            springGrenadeQuickItem.machine.PopAllStates();
            GameState.Current.Player.MoveController.ApplyForce(this._config.JumpDirection.normalized * (float)this._config.Force, CharacterMoveController.ForceType.Additive);
            AutoMonoBehaviour <SfxManager> .Instance.PlayInGameAudioClip(this.JumpSound, 0UL);

            base.StartCoroutine(this.DestroyDelayed(springGrenadeQuickItem.ID));
        }
        else
        {
            IGrenadeProjectile grenadeProjectile = this.Throw(position, velocity);
            grenadeProjectile.OnProjectileExploded += delegate(IGrenadeProjectile p)
            {
                Collider[] array = Physics.OverlapSphere(p.Position, 2f, UberstrikeLayerMasks.ExplosionMask);
                foreach (Collider collider in array)
                {
                    CharacterHitArea component = collider.gameObject.GetComponent <CharacterHitArea>();
                    if (component != null && component.RecieveProjectileDamage)
                    {
                        component.Shootable.ApplyForce(component.transform.position, this._config.JumpDirection.normalized * (float)this._config.Force);
                    }
                }
            };
        }
    }
Exemplo n.º 2
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.º 3
0
    // Token: 0x06001088 RID: 4232 RVA: 0x000663F8 File Offset: 0x000645F8
    private void InitializeQuickItem(GameObject quickItemObject, LoadoutSlotType slot, InventoryItem inventoryItem)
    {
        int       slotIndex = this.GetSlotIndex(slot);
        QuickItem component = quickItemObject.GetComponent <QuickItem>();

        if (component)
        {
            component.gameObject.SetActive(true);
            for (int i = 0; i < component.gameObject.transform.childCount; i++)
            {
                component.gameObject.transform.GetChild(i).gameObject.SetActive(false);
            }
            component.gameObject.name  = inventoryItem.Item.Name;
            component.transform.parent = GameState.Current.Player.WeaponAttachPoint;
            if (component.rigidbody)
            {
                component.rigidbody.isKinematic = true;
            }
            ItemConfigurationUtil.CopyProperties <UberStrikeItemQuickView>(component.Configuration, inventoryItem.Item.View);
            ItemConfigurationUtil.CopyCustomProperties(inventoryItem.Item.View, component.Configuration);
            if (component.Configuration.RechargeTime <= 0)
            {
                int index = slotIndex;
                QuickItemBehaviour behaviour = component.Behaviour;
                behaviour.OnActivated = (Action)Delegate.Combine(behaviour.OnActivated, new Action(delegate()
                {
                    this.UseConsumableItem(inventoryItem);
                    this.Restriction.DecreaseUse(index);
                    this.NextCooldownFinishTime = Time.time + 0.5f;
                }));
                this.Restriction.InitializeSlot(slotIndex, component, inventoryItem.AmountRemaining);
            }
            else
            {
                component.Behaviour.CurrentAmount = component.Configuration.AmountRemaining;
            }
            component.Behaviour.FocusKey = this.GetFocusKey(slot);
            IGrenadeProjectile grenadeProjectile = component as IGrenadeProjectile;
            if (grenadeProjectile != null)
            {
                grenadeProjectile.OnProjectileEmitted += delegate(IGrenadeProjectile p)
                {
                    Singleton <ProjectileManager> .Instance.AddProjectile(p, Singleton <WeaponController> .Instance.NextProjectileId());

                    GameState.Current.Actions.EmitQuickItem(p.Position, p.Velocity, inventoryItem.Item.View.ID, GameState.Current.PlayerData.Player.PlayerId, p.ID);
                };
            }
            if (this._quickItems[slotIndex])
            {
                UnityEngine.Object.Destroy(this._quickItems[slotIndex].gameObject);
            }
            this._quickItems[slotIndex] = component;
        }
        else
        {
            Debug.LogError("Failed to initialize QuickItem");
        }
        GameData.Instance.OnQuickItemsChanged.Fire();
    }
Exemplo n.º 4
0
    // Token: 0x06001A93 RID: 6803 RVA: 0x0008AC6C File Offset: 0x00088E6C
    public void EmitRemoteQuickItem(Vector3 origin, Vector3 direction, int itemId, byte playerNumber, int projectileID)
    {
        IUnityItem itemInShop = Singleton <ItemManager> .Instance.GetItemInShop(itemId);

        if (itemInShop != null)
        {
            if (itemInShop.Prefab)
            {
                IGrenadeProjectile grenadeProjectile = itemInShop.Prefab.GetComponent <QuickItem>() as IGrenadeProjectile;
                try
                {
                    IGrenadeProjectile grenadeProjectile2 = grenadeProjectile.Throw(origin, direction);
                    if (playerNumber == this.PlayerData.Player.PlayerId)
                    {
                        grenadeProjectile2.SetLayer(UberstrikeLayer.LocalProjectile);
                    }
                    else
                    {
                        grenadeProjectile2.SetLayer(UberstrikeLayer.RemoteProjectile);
                    }
                    Singleton <ProjectileManager> .Instance.AddProjectile(grenadeProjectile2, projectileID);
                }
                catch (Exception exception)
                {
                    Debug.LogWarning(string.Concat(new object[]
                    {
                        "OnEmitQuickItem failed because Item is not a projectile: ",
                        itemId,
                        "/",
                        playerNumber,
                        "/",
                        projectileID
                    }));
                    Debug.LogException(exception);
                }
            }
        }
        else
        {
            Debug.LogError(string.Concat(new object[]
            {
                "OnEmitQuickItem failed because item not found: ",
                itemId,
                "/",
                playerNumber,
                "/",
                projectileID
            }));
        }
    }