コード例 #1
0
 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));
 }
コード例 #2
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);
        }