Esempio n. 1
0
 /// <summary>
 /// 根据类型创建引擎数据
 /// </summary>
 private static CircuitElement CreateCircuit(LabObjType Type)
 {
     if (Type == LabObjType.Power)
     {
         return(new DCVoltageSource());
     }
     else if (Type == LabObjType.Switch)
     {
         return(new  SwitchSPST());
     }
     else if (Type == LabObjType.Light || Type == LabObjType.Resistance)
     {
         return(new Resistor());
     }
     if (Type == LabObjType.Ammeter)
     {
         return(new AmpereMeter());
     }
     if (Type == LabObjType.EleLine)
     {
         return(new Wire());
     }
     Debug.Log("LabObjectDataFactory CreateCircuit fail!");
     return(null);
 }
Esempio n. 2
0
 /// <summary>
 ///  添加元器件引擎数据
 /// </summary>
 public static void AddCircuit(int ObjID, LabObjType Type)
 {
     if (g_CircuitData.ContainsKey(ObjID) == true)
     {
         return;
     }
     else
     {
         CircuitElement ele = CreateCircuit(Type);
         if (ele != null)
         {
             g_CircuitData.Add(ObjID, ele);
         }
     }
 }