private void OnDestroy() { if (DecayingInventoryItemView.LastUsed == this) { DecayingInventoryItemView.LastUsed = null; } }
public override void OnItemDropped(GameObject worldGo) { DecayingItem component = worldGo.GetComponent <DecayingItem>(); if (component) { DecayingInventoryItemView.LastUsed = this; component._renderer.sharedMaterial = this._decayStatesMats[(int)this._state]; } }
public override void OnItemAdded() { DecayingInventoryItemView.LastUsed = this; if (this._state == DecayingInventoryItemView.DecayStates.None) { this.Decay(); } else { this._canDropFromInventory = (this._state == DecayingInventoryItemView.DecayStates.Spoilt && base.ItemCache.MatchType(Item.Types.WorldObject)); } }
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; } }
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; }
public override void OnItemRemoved() { DecayingInventoryItemView.LastUsed = this; this.ToggleState(DecayingInventoryItemView.DecayStates.None); }