Пример #1
0
    public void DeactiveAttachObject(GameObject go)
    {
        AttachPointInfo attachPointInfo = null;

        if (!_mAttachPointInfoList.TryGetValue(go.GetInstanceID(), out attachPointInfo))
        {
            return;
        }

        attachPointInfo.MAttachGameObject.SetActiveRecursively(false);
    }
Пример #2
0
    public bool GetAttachPointInfo(GameObject go, out AttachPointInfo attachPointInfo)
    {
        attachPointInfo = null;

        if (!_mAttachPointInfoList.TryGetValue(go.GetInstanceID(), out attachPointInfo))
        {
            return(false);
        }

        return(true);
    }
Пример #3
0
    public void DetachObject(GameObject go)
    {
        AttachPointInfo attachPoint = null;

        if (!_mAttachPointInfoList.TryGetValue(go.GetInstanceID(), out attachPoint))
        {
            return;
        }

        _mAttachPointInfoList.Remove(go.GetInstanceID());

        attachPoint.MParentGameObject = null;
        attachPoint.MAttachGameObject.transform.parent = null;
        GameObject.DestroyObject(attachPoint.MAttachGameObject);
    }
Пример #4
0
    public GameObject AttachObject(Object ob, Vector3 relPosition, Quaternion relRotation)
    {
        GameObject go = GameObject.Instantiate(ob, relPosition, relRotation) as GameObject;

        GameObject.DontDestroyOnLoad(go);

        AttachPointInfo attachPoint = new AttachPointInfo();

        attachPoint.MParentGameObject = this.MParentGameObject;
        attachPoint.MAttachGameObject = go;
        attachPoint.MAttachPosition   = relPosition;
        attachPoint.MAttachRotation   = relRotation;

        attachPoint.MAttachGameObject.transform.parent        = attachPoint.MParentGameObject.transform;
        attachPoint.MAttachGameObject.transform.localPosition = relPosition;
        attachPoint.MAttachGameObject.transform.localRotation = relRotation;

        _mAttachPointInfoList.Add(go.GetInstanceID(), attachPoint);

        return(go);
    }
Пример #5
0
    public GameObject AttachObject(GameObject go, Vector3 relPosition, Quaternion relRotation)
    {
        if (_mAttachPointInfoList.ContainsKey(go.GetInstanceID()))
        {
            return(null);
        }

        AttachPointInfo attachPoint = new AttachPointInfo();

        attachPoint.MParentGameObject = this.MParentGameObject;
        attachPoint.MAttachGameObject = go;
        attachPoint.MAttachPosition   = relPosition;
        attachPoint.MAttachRotation   = relRotation;

        attachPoint.MAttachGameObject.transform.parent        = attachPoint.MParentGameObject.transform;
        attachPoint.MAttachGameObject.transform.localPosition = relPosition;
        attachPoint.MAttachGameObject.transform.localRotation = relRotation;

        _mAttachPointInfoList.Add(go.GetInstanceID(), attachPoint);

        return(go);
    }