private SimulationComponent[] GetSimComponents(EComponentTag[] tags) { SimulationComponent[] comps = new SimulationComponent[tags.Length]; for (int i = 0; i < tags.Length; ++i) { SimulationComponent c = null; // | dj | not the most secure way but it should work. switch (tags[i]) { case EComponentTag.AgeingComponent: c = new AgeingComponent(110); break; case EComponentTag.InfectionComponent: c = new InfectionComponent(); break; case EComponentTag.DiseaseTickComponent: c = new DiseaseTickComponent(); break; case EComponentTag.DiseaseDeathComponent: c = new DiseaseDeathComponent(); break; case EComponentTag.DiseaseHealingComponent: c = new DiseaseHealingComponent(); break; case EComponentTag.MindsetComponent: c = new MindsetComponent(); break; case EComponentTag.MovementComponent: c = new MovementComponent(); break; } comps[i] = c; } // if no (diseasetick-)component given: debug-infection //if (comps.Length == 0) comps = new SimulationComponent[1] { new DebugInfectionComponent() }; if (!comps.Any(x => x is InfectionComponent)) { SimulationComponent[] temp = new SimulationComponent[comps.Length + 1]; comps.CopyToOtherArray(temp); temp[comps.Length] = new DebugInfectionComponent(); comps = temp; temp = null; } return comps; }
private void SetUp() { _component = new InfectionComponent(); }