Пример #1
0
        public static void RunSpawnProcessor(BaseDeconstructable baseDeconstructable, Base latestBase, Int3 latestCell, GameObject finishedPiece)
        {
            TechType techType = (TechType)baseDeconstructable.ReflectionGet("recipe");

            if (processorsByType.TryGetValue(techType, out BasePieceSpawnProcessor processor))
            {
                Log.Info($"Found custom BasePieceSpawnProcessor for {techType}");
                processor.SpawnPostProcess(latestBase, latestCell, finishedPiece);
            }
        }
        public static BasePieceSpawnProcessor From(BaseDeconstructable baseDeconstructable)
        {
            TechType techType = (TechType)baseDeconstructable.ReflectionGet("recipe");


            if (processorsByType.TryGetValue(techType, out BasePieceSpawnProcessor processor))
            {
                Log.Info("Found custom BasePieceSpawnProcessor for " + techType);
                return(processor);
            }

            return(noOpProcessor);
        }
Пример #3
0
        private Optional <GameObject> FindSecondLadderPiece(Base latestBase, Int3 cellToSearch)
        {
            Transform cellTransform = latestBase.GetCellObject(cellToSearch);

            foreach (Transform child in cellTransform)
            {
                NitroxEntity        id = child.GetComponent <NitroxEntity>();
                BaseDeconstructable baseDeconstructable = child.GetComponent <BaseDeconstructable>();

                bool isNewBasePiece = (id == null && baseDeconstructable != null);

                if (isNewBasePiece)
                {
                    TechType techType = (TechType)baseDeconstructable.ReflectionGet("recipe");

                    if (techType == TechType.BaseLadder)
                    {
                        return(Optional <GameObject> .Of(child.gameObject));
                    }
                }
            }

            return(Optional <GameObject> .Empty());
        }