public MouthSimulator(Mouth mouth, MouthUpdater mouthUpdater) { this.mouth = mouth; timeline = new Timeline(); timeline.IntervalTick += timeline_intervalTick; this.mouthUpdater = mouthUpdater; }
// TODO: Formulate general entity updating convention // TODO: Add ability to update individual teeth public void Update(ref Mouth mouth) { foreach(UpdateProperty prop in Properties) { if(prop.AllTeeth == true) { log.InfoFormat("Updating parameter {0} of all teeth to {1}", prop.Name, prop.NewValue); mouth.Teeth.ForEach(t => { ToothParameter param = t.Parameters.Single(p => p.Name == prop.Name); if(param == null) { log.ErrorFormat("Property with name {0} does not exist"); } t.Parameters.Single(p => p.Name == prop.Name).Value = prop.NewValue; }); } else { // TODO: Handle cases where not all teeth are updated } } }
public void Update(ref Mouth mouth, uint timeStep) { map[timeStep].Update(ref mouth); }