public SmartAction ActionFactory(int id, SmartSource source, SmartTarget target) { if (!SmartDataManager.GetInstance().Contains(SmartType.SmartAction, id)) { throw new NullReferenceException("No data for action id " + id); } SmartAction action = new SmartAction(id, source, target); SetParameterObjects(action, SmartDataManager.GetInstance().GetRawData(SmartType.SmartAction, id)); return(action); }
public SmartSource SourceFactory(int id) { if (!SmartDataManager.GetInstance().Contains(SmartType.SmartSource, id)) { throw new NullReferenceException("No data for source id " + id); } SmartSource source = new SmartSource(id); SetParameterObjects(source, SmartDataManager.GetInstance().GetRawData(SmartType.SmartSource, id)); return(source); }
public SmartTarget TargetFactory(int id) { if (!SmartDataManager.GetInstance().Contains(SmartType.SmartTarget, id)) { throw new NullReferenceException("No data for target id " + id); } SmartTarget target = new SmartTarget(id); SetParameterObjects(target, SmartDataManager.GetInstance().GetRawData(SmartType.SmartTarget, id)); if (SmartDataManager.GetInstance().GetRawData(SmartType.SmartTarget, id).Types.Contains("Position")) { target.IsPosition = true; } return(target); }
public SmartEvent EventFactory(int id) { if (!SmartDataManager.GetInstance().Contains(SmartType.SmartEvent, id)) { throw new NullReferenceException("No data for event id " + id); } SmartEvent ev = new SmartEvent(id); var raw = SmartDataManager.GetInstance().GetRawData(SmartType.SmartEvent, id); ev.Chance.SetValue(100); SetParameterObjects(ev, raw); if (raw.DescriptionRules != null) { ev.DescriptionRules = new List <DescriptionRule>(); foreach (var rule in raw.DescriptionRules) { ev.DescriptionRules.Add(new DescriptionRule(rule)); } } return(ev); }