public void CancelCommandFor(DecayingInventoryItemView diiv) { int num = this._commands.IndexOf(this._commands.FirstOrDefault((ItemDecayMachine.ItemDecayCommand c) => c._diiv.Equals(diiv))); if (num >= 0) { this._commands.RemoveAt(num); } if (this._commands.Count == 0) { base.enabled = false; } }
private void OnStateRefresh() { if (LocalPlayer.Inventory) { DecayingInventoryItemView decayingInventoryItemView = LocalPlayer.Inventory.InventoryItemViewsCache[this._itemId][0] as DecayingInventoryItemView; if (decayingInventoryItemView) { this._renderer.sharedMaterial = decayingInventoryItemView.GetMaterialForState(this.DecayState); } } if (this._pickup) { this._pickup._state = this.DecayState; } }
public void NewDecayCommand(DecayingInventoryItemView diiv, float decayDuration) { int num = 0; float decayTime = Time.time + decayDuration; this.CancelCommandFor(diiv); if (this._commands.Count > 0) { num = this._commands.IndexOf(this._commands.FirstOrDefault((ItemDecayMachine.ItemDecayCommand c) => c._decayTime > decayTime)); if (num < 0) { num = this._commands.Count; } } this._commands.Insert(num, new ItemDecayMachine.ItemDecayCommand { _diiv = diiv, _decayTime = decayTime }); base.enabled = true; }