Exemple #1
0
        public void SetPhysicsMeshParam(apPhysicsMeshParam srcMeshParam)
        {
            _isRestrictStretchRange = srcMeshParam._isRestrictStretchRange;
            _isRestrictMoveRange    = srcMeshParam._isRestrictMoveRange;

            _moveRange = srcMeshParam._moveRange;
            //_stretchRange_Min = srcMeshParam._stretchRangeRatio_Min;
            _stretchRange_Max = srcMeshParam._stretchRangeRatio_Max;
            _stretchK         = srcMeshParam._stretchK;
            _inertiaK         = srcMeshParam._inertiaK;
            _damping          = srcMeshParam._damping;
            _mass             = srcMeshParam._mass;

            //Gravity와 Wind는 Constant로 저장된다.
            //ControlParam인 경우는 ID를 제외하고 저장 (ID는 저장하지 않는다. 링크는 직접 해야함)
            _gravityParamType  = srcMeshParam._gravityParamType;
            _gravityConstValue = srcMeshParam._gravityConstValue;
            _windParamType     = srcMeshParam._windParamType;
            _windConstValue    = srcMeshParam._windConstValue;
            _windRandomRange   = srcMeshParam._windRandomRange;

            _airDrag   = srcMeshParam._airDrag;
            _viscosity = srcMeshParam._viscosity;
            _restoring = srcMeshParam._restoring;
        }
Exemple #2
0
        public void Load(List <string> loadedStringSet)
        {
            _uniqueID = -1;            //<<이게 안바뀌면 실패다

            string strKey = "", strValue = "";
            string strCur = "";

            for (int i = 0; i < loadedStringSet.Count; i++)
            {
                strCur = loadedStringSet[i];
                if (strCur.Length < 3)
                {
                    continue;
                }

                strKey = strCur.Substring(0, 3);

                if (strCur.Length > 3)
                {
                    strValue = strCur.Substring(3);
                }
                else
                {
                    strValue = "";
                }

                try
                {
                    if (strKey == "UID")
                    {
                        //sw.WriteLine("UID" + _uniqueID);
                        _uniqueID = int.Parse(strValue);
                    }
                    else if (strKey == "NAM")
                    {
                        //sw.WriteLine("NAM" + _name);
                        _name = strValue;
                    }
                    else if (strKey == "ICN")
                    {
                        //sw.WriteLine("ICN" + _icon);
                        _icon = (ICON)int.Parse(strValue);
                    }
                    else if (strKey == "IMR")
                    {
                        _isRestrictMoveRange = bool.Parse(strValue);
                    }
                    else if (strKey == "ISR")
                    {
                        _isRestrictStretchRange = bool.Parse(strValue);
                    }
                    //else if (strKey == "SMN")
                    //{
                    //	//sw.WriteLine("STR" + _stretchRange);
                    //	_stretchRange_Min = float.Parse(strValue);
                    //}
                    else if (strKey == "SMX")
                    {
                        //sw.WriteLine("STR" + _stretchRange);
                        _stretchRange_Max = float.Parse(strValue);
                    }
                    else if (strKey == "MRG")
                    {
                        //sw.WriteLine("STR" + _stretchRange);
                        _moveRange = float.Parse(strValue);
                    }
                    else if (strKey == "STK")
                    {
                        //sw.WriteLine("STK" + _stretchK);
                        _stretchK = float.Parse(strValue);
                    }
                    else if (strKey == "INK")
                    {
                        //sw.WriteLine("INK" + _inertiaK);
                        _inertiaK = float.Parse(strValue);
                    }
                    else if (strKey == "DMP")
                    {
                        //sw.WriteLine("DMP" + _damping);
                        _damping = float.Parse(strValue);
                    }
                    else if (strKey == "MSS")
                    {
                        //sw.WriteLine("MSS" + _mass);
                        _mass = float.Parse(strValue);
                    }
                    else if (strKey == "GPT")
                    {
                        //sw.WriteLine("GPT" + (int)_gravityParamType);
                        _gravityParamType = (apPhysicsMeshParam.ExternalParamType)(int.Parse(strValue));
                    }
                    else if (strKey == "GVX")
                    {
                        //sw.WriteLine("GVX" + _gravityConstValue.x);
                        _gravityConstValue.x = float.Parse(strValue);
                    }
                    else if (strKey == "GVY")
                    {
                        //sw.WriteLine("GVY" + _gravityConstValue.y);
                        _gravityConstValue.y = float.Parse(strValue);
                    }
                    else if (strKey == "WPT")
                    {
                        //sw.WriteLine("WPT" + (int)_windParamType);
                        _windParamType = (apPhysicsMeshParam.ExternalParamType)(int.Parse(strValue));
                    }
                    else if (strKey == "WVX")
                    {
                        //sw.WriteLine("WVX" + _windConstValue.x);
                        _windConstValue.x = float.Parse(strValue);
                    }
                    else if (strKey == "WVY")
                    {
                        //sw.WriteLine("WVY" + _windConstValue.y);
                        _windConstValue.y = float.Parse(strValue);
                    }
                    else if (strKey == "WRX")
                    {
                        //sw.WriteLine("WRX" + _windRandomRange.x);
                        _windRandomRange.x = float.Parse(strValue);
                    }
                    else if (strKey == "WRY")
                    {
                        //sw.WriteLine("WRY" + _windRandomRange.y);
                        _windRandomRange.y = float.Parse(strValue);
                    }
                    else if (strKey == "ADG")
                    {
                        //sw.WriteLine("ADG" + _airDrag);
                        _airDrag = float.Parse(strValue);
                    }
                    else if (strKey == "VCS")
                    {
                        //sw.WriteLine("VCS" + _viscosity);
                        _viscosity = float.Parse(strValue);
                    }
                    else if (strKey == "RST")
                    {
                        //sw.WriteLine("RST" + _restoring);
                        _restoring = float.Parse(strValue);
                    }
                    else
                    {
                        Debug.LogError("Unknown PhysicPreset Load Keyword [" + strKey + "]");
                    }
                }
                catch (Exception ex)
                {
                    Debug.LogError("PhysicsPreset Load Exception : " + ex);
                }
            }
        }