Exemple #1
0
 public void AddNode(ResearchType type, Type unlockOn, IResearchParameter parameters)
 {
     if (CurrentItem is LeafResearchItem)
     {
         throw new Exception("cannot add to leaf node");
     }
     if (CurrentItem is RootResearchItem)
     {
         ((RootResearchItem)CurrentItem).AddChildUnlock(new CompositeResearchItem(type, unlockOn, parameters));
     }
     else
     {
         ((CompositeResearchItem)CurrentItem).AddChildUnlock(new CompositeResearchItem(type, unlockOn, parameters));
     }
 }
Exemple #2
0
        public ResearchItem(ResearchType type, Type unlockOn, IResearchParameter parameters)
        {
            switch (type)
            {
            case (ResearchType.ConverterInputResourceUnlock):
                if (!(parameters is ConverterInputResourceParameters))
                {
                    throw new Exception("Invalid research type and parameter pairing");
                }
                break;

            case (ResearchType.ProducerAmountBoost):
                if (!(parameters is ProducerAmountParameters))
                {
                    throw new Exception("Invalid research type and parameter pairing");
                }
                break;

            case (ResearchType.ProducerResourceUnlock):
                if (!(parameters is ProducerProductParameters))
                {
                    throw new Exception("Invalid research type and parameter pairing");
                }
                break;

            case (ResearchType.ConverterOutputUnlock):
                if (!(parameters is ConverterOutputForInputResourceParameter))
                {
                    throw new Exception("Invalid research type and parameter pairing");
                }
                break;
            }
            ResearchType    = type;
            UnlockOn        = unlockOn;
            IsApplied       = false;
            this.parameters = parameters;
        }
Exemple #3
0
 public CompositeResearchItem(ResearchType type, Type unlockOn, IResearchParameter parameters) : base(type, unlockOn, parameters)
 {
     childUnlocks = new List <ResearchItem>();
 }
Exemple #4
0
 public LeafResearchItem(ResearchType type, Type unlockOn, IResearchParameter parameters) : base(type, unlockOn, parameters)
 {
 }