コード例 #1
0
        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); }
        }
コード例 #2
0
 public static double ComputeEffect(AugmentorType AttachedType, int AttachedQuantity, bool RequiresInput, int ProcessingTime = 60)
 {
     if (AttachedType == AugmentorType.Output)
     {
         return(OutputAugmentor.ComputeEffect(AttachedQuantity, RequiresInput));
     }
     else if (AttachedType == AugmentorType.Speed)
     {
         return(SpeedAugmentor.ComputeEffect(AttachedQuantity, RequiresInput));
     }
     else if (AttachedType == AugmentorType.Efficiency)
     {
         return(EfficiencyAugmentor.ComputeEffect(AttachedQuantity, RequiresInput));
     }
     else if (AttachedType == AugmentorType.Quality)
     {
         return(QualityAugmentor.ComputeEffect(AttachedQuantity, RequiresInput));
     }
     else if (AttachedType == AugmentorType.Production)
     {
         return(ProductionAugmentor.ComputeEffect(AttachedQuantity, RequiresInput));
     }
     else if (AttachedType == AugmentorType.Duplication)
     {
         return(DuplicationAugmentor.ComputeEffect(AttachedQuantity, RequiresInput, ProcessingTime));
     }
     else
     {
         throw new NotImplementedException(string.Format("Unrecognized AugmentorType: {0}", AttachedType.ToString()));
     }
 }
コード例 #3
0
        internal void OnProductsCollected(CheckForActionData CFAData)
        {
            if (!CFAData.IsLocalPlayer)
            {
                return;
            }

            if (CFAData.CurrentHeldObject != null)
            {
                //  This point of the code should be reached when collecting from a machine that does not require inputs
                //  such as when collecting from a Bee Hive / Crystalarium / Tapper, a new product is automatically placed back into the machine and the MinutesUntilReady gets reset
                if (TryFindAugmentedTile(CFAData.Machine, CFAData.Machine.TileLocation, out AugmentedTile AT))
                {
                    foreach (KeyValuePair <AugmentorType, int> KVP in GetOrderedEnumerable(AT.Quantities))
                    {
                        AugmentorType Type             = KVP.Key;
                        int           AttachedQuantity = KVP.Value;

                        if (AttachedQuantity > 0)
                        {
                            if (Type == AugmentorType.Output)
                            {
                                OutputAugmentor.OnProductsCollected(CFAData, AttachedQuantity);
                            }
                            else if (Type == AugmentorType.Speed)
                            {
                                SpeedAugmentor.OnProductsCollected(CFAData, AttachedQuantity);
                            }
                            else if (Type == AugmentorType.Efficiency)
                            {
                                EfficiencyAugmentor.OnProductsCollected(CFAData, AttachedQuantity);
                            }
                            else if (Type == AugmentorType.Quality)
                            {
                                QualityAugmentor.OnProductsCollected(CFAData, AttachedQuantity);
                            }
                            else if (Type == AugmentorType.Production)
                            {
                                ProductionAugmentor.OnProductsCollected(CFAData, AttachedQuantity);
                            }
                            else if (Type == AugmentorType.Duplication)
                            {
                                DuplicationAugmentor.OnProductsCollected(CFAData, AttachedQuantity);
                            }
                            else
                            {
                                throw new NotImplementedException(string.Format("Unrecognized AugmentorType: {0}", Type.ToString()));
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        internal void OnInputsInserted(PerformObjectDropInData PODIData)
        {
            if (!PODIData.IsLocalPlayer)
            {
                return;
            }

            //  This point of the code should be reached when placing an input item into a machine that requires inputs,
            //  such as when placing Copper Ore into a furnace
            if (TryFindAugmentedTile(PODIData.Machine, PODIData.Machine.TileLocation, out AugmentedTile AT))
            {
                foreach (KeyValuePair <AugmentorType, int> KVP in GetOrderedEnumerable(AT.Quantities))
                {
                    AugmentorType Type             = KVP.Key;
                    int           AttachedQuantity = KVP.Value;

                    if (AttachedQuantity > 0)
                    {
                        if (Type == AugmentorType.Output)
                        {
                            OutputAugmentor.OnInputsInserted(PODIData, AttachedQuantity);
                        }
                        else if (Type == AugmentorType.Speed)
                        {
                            SpeedAugmentor.OnInputsInserted(PODIData, AttachedQuantity);
                        }
                        else if (Type == AugmentorType.Efficiency)
                        {
                            EfficiencyAugmentor.OnInputsInserted(PODIData, AttachedQuantity);
                        }
                        else if (Type == AugmentorType.Quality)
                        {
                            QualityAugmentor.OnInputsInserted(PODIData, AttachedQuantity);
                        }
                        else if (Type == AugmentorType.Production)
                        {
                            ProductionAugmentor.OnInputsInserted(PODIData, AttachedQuantity);
                        }
                        else if (Type == AugmentorType.Duplication)
                        {
                            DuplicationAugmentor.OnInputsInserted(PODIData, AttachedQuantity);
                        }
                        else
                        {
                            throw new NotImplementedException(string.Format("Unrecognized AugmentorType: {0}", Type.ToString()));
                        }
                    }
                }
            }
        }