internal void Update() { // Check if the Machine has been removed from this tile if (!Location.Location.Objects.TryGetValue(new Vector2(Position.X, Position.Y), out Object CurrentMachine) || CurrentMachine != Machine) { Location.OnMachineRemoved(this); return; } try { if (!Context.IsMultiplayer || Context.IsMainPlayer) { if (PreviousMachineState != null) { if (PreviousMachineState.PreviousMinutesUntilReady <= 0 && PreviousMachineState.CurrentMinutesUntilReady > 0) { foreach (KeyValuePair <AugmentorType, int> KVP in PlacedAugmentorsManager.GetOrderedEnumerable(Quantities)) { AugmentorType Type = KVP.Key; int AttachedQuantity = KVP.Value; if (AttachedQuantity > 0) { if (Type == AugmentorType.Output) { OutputAugmentor.OnMinutesUntilReadySet(PreviousMachineState, AttachedQuantity); } else if (Type == AugmentorType.Speed) { SpeedAugmentor.OnMinutesUntilReadySet(PreviousMachineState, AttachedQuantity); } else if (Type == AugmentorType.Efficiency) { EfficiencyAugmentor.OnMinutesUntilReadySet(PreviousMachineState, AttachedQuantity); } else if (Type == AugmentorType.Quality) { QualityAugmentor.OnMinutesUntilReadySet(PreviousMachineState, AttachedQuantity); } else if (Type == AugmentorType.Production) { ProductionAugmentor.OnMinutesUntilReadySet(PreviousMachineState, AttachedQuantity); } else if (Type == AugmentorType.Duplication) { DuplicationAugmentor.OnMinutesUntilReadySet(PreviousMachineState, AttachedQuantity); } else { throw new NotImplementedException(string.Format("Unrecognized AugmentorType: {0}", Type.ToString())); } } } } } } } finally { PreviousMachineState = new MachineState(this.Machine); } }