Пример #1
0
        //public apControlParam AddParam_Vector3(string keyName, bool isReserved, apControlParam.CATEGORY category, Vector3 defaultValue)
        //{
        //	apControlParam newParam = MakeNewParam(keyName, isReserved, category);
        //	if(newParam == null) { return null; }
        //	newParam.SetVector3(defaultValue);
        //	return newParam;
        //}

        //public apControlParam AddParam_Vector3(string keyName, bool isReserved, apControlParam.CATEGORY category, Vector3 defaultValue, Vector3 min, Vector3 max, string label_Axis1, string label_Axis2, string label_Axis3)
        //{
        //	apControlParam newParam = MakeNewParam(keyName, isReserved, category);
        //	if(newParam == null) { return null; }
        //	newParam.SetVector3(defaultValue, min, max, label_Axis1, label_Axis2, label_Axis3);
        //	return newParam;
        //}

        //public apControlParam AddParam_Color(string keyName, bool isReserved, apControlParam.CATEGORY category, Color defaultValue)
        //{
        //	apControlParam newParam = MakeNewParam(keyName, isReserved, category);
        //	if(newParam == null) { return null; }
        //	newParam.SetColor(defaultValue);
        //	return newParam;
        //}

        public apControlParam MakeNewParam(string keyName, bool isReserved, apControlParam.CATEGORY category)
        {
            //Debug.Log("Make New Param <" + keyName + ">");
            //apControlParam existParam = FindParam(keyName);
            //if (existParam != null)
            //{
            //	Debug.LogError("키 겹침 문제");
            //	return null;
            //}
            //겹침은 ID로만

            //int nextID = _portrait.MakeUniqueID_ControlParam();
            int nextID = _portrait.MakeUniqueID(apIDManager.TARGET.ControlParam);

            if (nextID < 0)
            {
                Debug.LogError("ID Creating Failed");
                return(null);
            }

            apControlParam newParam = new apControlParam(nextID, keyName, isReserved, category);

            _controlParams.Add(newParam);
            return(newParam);
        }
        // Functions
        //--------------------------------------
        public void SetMeshGroup(apMeshGroup meshGroup)
        {
            if (meshGroup == null)
            {
                _childMeshGroup = null;

                //ID를 반납하자
                if (_childMeshGroupTransform != null)
                {
                    //_portrait.PushUniqueID_Transform(_childMeshGroupTransform._transformUniqueID);
                    _portrait.PushUnusedID(apIDManager.TARGET.Transform, _childMeshGroupTransform._transformUniqueID);

                    _childMeshGroupTransform = null;
                }
                _renderUnit = null;
            }
            if (meshGroup != null)
            {
                _childMeshGroup = meshGroup;

                bool resetMeshGroupTransform = false;
                if (_childMeshGroupTransform == null)
                {
                    resetMeshGroupTransform = true;
                }
                else if (_childMeshGroupTransform._meshGroupUniqueID != meshGroup._uniqueID)
                {
                    //_portrait.PushUniqueID_Transform(_childMeshGroupTransform._transformUniqueID);
                    _portrait.PushUnusedID(apIDManager.TARGET.Transform, _childMeshGroupTransform._transformUniqueID);

                    _childMeshGroupTransform = null;
                    resetMeshGroupTransform  = true;
                }

                if (resetMeshGroupTransform)
                {
                    //Root는 별도의 Transform_MeshGroup을 가진다.

                    //새로운 ID로 Transform을 만들자
                    //_childMeshGroupTransform = new apTransform_MeshGroup(_portrait.MakeUniqueID_Transform());
                    _childMeshGroupTransform = new apTransform_MeshGroup(_portrait.MakeUniqueID(apIDManager.TARGET.Transform));

                    _childMeshGroupTransform._meshGroupUniqueID = meshGroup._uniqueID;
                    _childMeshGroupTransform._nickName          = meshGroup._name;
                    _childMeshGroupTransform._meshGroup         = meshGroup;
                    _childMeshGroupTransform._matrix            = new apMatrix();
                    _childMeshGroupTransform._isVisible_Default = true;

                    _childMeshGroupTransform._depth = 1;

                    //추가
                    //Root Transform_MeshGroup에 해당하는 RenderUnit
                    _renderUnit = new apRenderUnit(_portrait, "Root");
                    _renderUnit.SetGroup(meshGroup, _childMeshGroupTransform, null);
                    _renderUnit._childRenderUnits.Add(meshGroup._rootRenderUnit);
                }
                else
                {
                    _childMeshGroupTransform._meshGroup = meshGroup;                    //Link만 하자
                    if (_renderUnit == null)
                    {
                        _renderUnit = new apRenderUnit(_portrait, "Root");
                        _renderUnit.SetGroup(meshGroup, _childMeshGroupTransform, null);
                        _renderUnit._childRenderUnits.Add(meshGroup._rootRenderUnit);
                    }
                    else
                    {
                        _renderUnit._meshGroupTransform = _childMeshGroupTransform;
                        _renderUnit._meshGroup          = meshGroup;
                        _renderUnit._childRenderUnits.Clear();
                        _renderUnit._childRenderUnits.Add(meshGroup._rootRenderUnit);
                    }
                }
            }
        }