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)); } }
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; }
public CompositeResearchItem(ResearchType type, Type unlockOn, IResearchParameter parameters) : base(type, unlockOn, parameters) { childUnlocks = new List <ResearchItem>(); }
public LeafResearchItem(ResearchType type, Type unlockOn, IResearchParameter parameters) : base(type, unlockOn, parameters) { }