コード例 #1
0
ファイル: NetMainPrefab.cs プロジェクト: Virobeast2/RCLIENT
    public static IDRemote DoLocalAppend(IDRemote localAppend, IDMain instance, Transform appendPoint)
    {
        Transform transform = localAppend.transform;

        if (localAppend.transform != localAppend.transform.root)
        {
            Debug.LogWarning("The localAppend transform was not a root");
        }
        IDRemote  remote     = (IDRemote)UnityEngine.Object.Instantiate(localAppend, appendPoint.TransformPoint(transform.localPosition), appendPoint.rotation * transform.localRotation);
        Transform transform2 = remote.transform;

        transform2.parent        = appendPoint;
        transform2.localPosition = transform.localPosition;
        transform2.localRotation = transform.localRotation;
        transform2.localScale    = transform.localScale;
        remote.idMain            = instance;
        foreach (IDRemote remote2 in instance.GetComponentsInChildren <IDRemote>())
        {
            if (remote2.idMain == null)
            {
                remote2.idMain = instance;
            }
        }
        return(remote);
    }
コード例 #2
0
    public static IDRemote DoLocalAppend(IDRemote localAppend, IDMain instance, Transform appendPoint)
    {
        Transform transforms = localAppend.transform;

        if (localAppend.transform != localAppend.transform.root)
        {
            Debug.LogWarning("The localAppend transform was not a root");
        }
        IDRemote  dRemote     = (IDRemote)UnityEngine.Object.Instantiate(localAppend, appendPoint.TransformPoint(transforms.localPosition), appendPoint.rotation * transforms.localRotation);
        Transform transforms1 = dRemote.transform;

        transforms1.parent        = appendPoint;
        transforms1.localPosition = transforms.localPosition;
        transforms1.localRotation = transforms.localRotation;
        transforms1.localScale    = transforms.localScale;
        dRemote.idMain            = instance;
        IDRemote[] componentsInChildren = instance.GetComponentsInChildren <IDRemote>();
        for (int i = 0; i < (int)componentsInChildren.Length; i++)
        {
            IDRemote dRemote1 = componentsInChildren[i];
            if (!dRemote1.idMain)
            {
                dRemote1.idMain = instance;
            }
        }
        return(dRemote);
    }