Exemple #1
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();
    }
 // Token: 0x0600106F RID: 4207 RVA: 0x0000B7DE File Offset: 0x000099DE
 public CoolingDownState(QuickItemBehaviour behaviour)
 {
     this.behaviour = behaviour;
 }
 // Token: 0x06001046 RID: 4166 RVA: 0x0000B58D File Offset: 0x0000978D
 private void Awake()
 {
     this.Behaviour = new QuickItemBehaviour(this, new Action(this.OnActivated));
 }