public override void SetCapabilities()
 {
     puzzleDefinition = UserManager.GetCurrentUser().GetSolutionManager().puzzleDefinition as ResearchNetResearchPuzzleDefinition;
     if (puzzleDefinition.bonderCount > 0)
     {
         availableInstructions.Add(typeof(BondInstruction));
         availableFeatures.Add(typeof(BonderFeature), puzzleDefinition.bonderCount);
     }
     if (puzzleDefinition.hasSensor)
     {
         availableInstructions.Add(typeof(SensorInstruction));
         availableFeatures.Add(typeof(SensorFeature), puzzleDefinition.GetFeatureCount(FeatureType.Sensor));
     }
     if (puzzleDefinition.hasFuser)
     {
         availableInstructions.Add(typeof(FuseInstruction));
         availableFeatures.Add(typeof(FuserFeature), puzzleDefinition.GetFeatureCount(FeatureType.Fuser));
     }
     if (puzzleDefinition.hasSplitter)
     {
         availableInstructions.Add(typeof(SplitInstruction));
         availableFeatures.Add(typeof(SplitterFeature), puzzleDefinition.GetFeatureCount(FeatureType.Splitter));
     }
     if (!puzzleDefinition.hasTeleporter)
     {
         return;
     }
     availableInstructions.Add(typeof(SwapInstruction));
     availableFeatures.Add(typeof(QuantumTunnelFeature), puzzleDefinition.GetFeatureCount(FeatureType.Teleporter));
 }
        public override void InitializeReactor()
        {
            if (puzzleDefinition.hasLargeOutput)
            {
                reactorScreen = new LargeOutputReactorArea(this);
            }
            else
            {
                reactorScreen = new ReactorScreen(this);
            }
            Reactor reactor = new Reactor(reactorScreen, new Vector2i(117, 4), new Vector2i(10, 8), puzzleDefinition.hasLargeOutput ? ReactorLayout.LargeOutput : ReactorLayout.Regular, false);

            reactorScreen.reactor = reactor;
            if (!HasExistingReactor() && !Constants.unknown1)
            {
                AddStartInstructions();
                Vector2i firstBonderPosition = new Vector2i(4, 3 - (puzzleDefinition.bonderCount - 1) / 4);
                for (int i = 0; i < puzzleDefinition.bonderCount; ++i)
                {
                    reactor.AddMember(new Vector2i(firstBonderPosition.x + i % 2, firstBonderPosition.y + i / 2), ReactorLayer.Background, new BonderFeature(reactor));
                }
                for (int i = 0; i < puzzleDefinition.GetFeatureCount(FeatureType.Sensor); i++)
                {
                    Vector2i position = new Vector2i(2 + i % 2, 3 - i / 2);
                    reactor.AddMember(position, ReactorLayer.Background, new SensorFeature(reactor));
                }
                for (int i = 0; i < puzzleDefinition.GetFeatureCount(FeatureType.Splitter); i++)
                {
                    reactor.AddMember(new Vector2i(6, 4 + i), ReactorLayer.Background, new SplitterFeature(reactor));
                }
                for (int i = 0; i < puzzleDefinition.GetFeatureCount(FeatureType.Fuser); i++)
                {
                    reactor.AddMember(new Vector2i(6, 3 - i), ReactorLayer.Background, new FuserFeature(reactor));
                }
                for (int i = 0; i < puzzleDefinition.GetFeatureCount(FeatureType.Teleporter); i++)
                {
                    Vector2i position = new Vector2i(2 + i % 2, 4 + i / 2);
                    reactor.AddMember(position, ReactorLayer.Background, new QuantumTunnelFeature(reactor));
                }
            }
            reactorScreen.instructionsPanel = new InstructionsPanel(reactor, availableInstructions);
            reactorScreen.simulationEngine  = new ReactorSimulationEngine(reactor);
        }
示例#3
0
        public override bool IsIncompatibleWith(ResearchNetPuzzleDefinition definition)
        {
            ResearchNetResearchPuzzleDefinition otherDef = definition as ResearchNetResearchPuzzleDefinition;

            if (otherDef == null)
            {
                return(false);
            }
            // The enum constants aren't available at runtime, so we can't use Enum.GetValues().
            // The best we can do is to hardcode the last enum member like this.
            for (int i = 0; i <= (int)FeatureType.Splitter; i++)
            {
                FeatureType featureType = (FeatureType)i;
                if (GetFeatureCount(featureType) != otherDef.GetFeatureCount(featureType))
                {
                    return(true);
                }
            }
            return(false);
        }
示例#4
0
 private int GetFeatureCount(FeatureType featureType)
 {
     return(puzzleDefinition.GetFeatureCount(featureType));
 }