Example #1
0
    /// <summary>
    /// create lab object by click | drag way.
    /// </summary>
    /// <param name="createWay">0:Click 1:Drag</param>
    private GameObject CreateLabObj(int createWay)
    {
        if (m_PerfabName == "")
        {
            return(null);
        }

        GameObject obj = NDLoad.LoadPrefab(m_PerfabName, LabEnv.NodeLab.transform);

        if (obj == null)
        {
            return(null);
        }

        if (createWay == 0)
        {
            SetPosOffset(obj);
            SetPreCreateObjData();
        }
        else
        {
            LabEnv.ResetPreCreateLabObj();
        }

        NDCircuitObject o = obj.GetComponent <NDCircuitObject>();

        if (o != null)
        {
            o.SetDefaultData();
            o.SetGameobjectName();
        }
        m_labObject = o;
        return(obj);
    }
Example #2
0
    public static NDlabObject  LoadObjType(int LabObjType, Transform parent)
    {
        LabObjUnit unit = AppData.ObjData.FindObjUnit(LabObjType);

        if (unit != null)
        {
            GameObject g = NDLoad.LoadPrefab(unit.AssestPath, parent, false);
            if (g == null)
            {
                return(null);
            }
            return(g.GetComponent <NDlabObject> ());
        }
        return(null);
    }