Ejemplo n.º 1
0
 private void ForceCurrentLod()
 {
     foreach (var value in _wardrobes)
     {
         if (null == value)
         {
             continue;
         }
         try
         {
             _setLodLevelInfo.BeginProfileOnlyEnableProfile();
             if (_forceLodLevel >= 0)
             {
                 MyLodGroup.SetLogLevel(value.DefaultGameObject, _forceLodLevel);
                 MyLodGroup.SetLogLevel(value.AlternativeGameObject, _forceLodLevel);
                 continue;
             }
             if (value.Type == StandardPart)
             {
                 continue;
             }
             MyLodGroup.SetLogLevel(value.DefaultGameObject, _currentLodLevel);
             MyLodGroup.SetLogLevel(value.AlternativeGameObject, _currentLodLevel);
         }
         finally
         {
             _setLodLevelInfo.EndProfileOnlyEnableProfile();
         }
     }
 }
Ejemplo n.º 2
0
        private void CalcCurrentLod()
        {
            var head = _wardrobes[(int)StandardPart];

            if (null == head)
            {
                return;
            }
            var lodLevel = MyLodGroup.GetLogLevel(head.DefaultGameObject);

            foreach (var value in _wardrobes)
            {
                if (null == value)
                {
                    continue;
                }
                MyLodGroup.SetLogLevel(value.DefaultGameObject, lodLevel);
                MyLodGroup.SetLogLevel(value.AlternativeGameObject, lodLevel);
            }
        }
Ejemplo n.º 3
0
        private void CalcCurrentLod()
        {
            try
            {
                _updateLodInfo.BeginProfileOnlyEnableProfile();
                var head = _wardrobes[(int)StandardPart];
                if (null == head)
                {
                    return;
                }

                var needChangeLodLevel = false;
                try
                {
                    _getLodLevelInfo.BeginProfileOnlyEnableProfile();

                    var lodLevel = MyLodGroup.GetLogLevel(head.DefaultGameObject);
                    needChangeLodLevel = lodLevel != _currentLodLevel;
                    _currentLodLevel   = lodLevel;
                }
                finally
                {
                    _getLodLevelInfo.EndProfileOnlyEnableProfile();
                }

                if (!needChangeLodLevel)
                {
                    return;
                }
                ForceCurrentLod();
            }
            finally
            {
                _updateLodInfo.EndProfileOnlyEnableProfile();
            }
        }
Ejemplo n.º 4
0
        public void Update()
        {
            try
            {
                _mainInfo.BeginProfileOnlyEnableProfile();

                try
                {
                    _updateBagTransformInfo.BeginProfileOnlyEnableProfile();
                    var param = _wardrobes[(int)Wardrobe.Bag];
                    if (param != null)
                    {
                        if (_attachment6Parent != null && _attachment6ParentInChar != null)
                        {
                            _attachment6Parent.SetPositionAndRotation(_attachment6ParentInChar.position,
                                                                      _attachment6ParentInChar.rotation);
                        }

                        if (_attachment7Parent != null && _attachment7ParentInChar != null)
                        {
                            _attachment7Parent.SetPositionAndRotation(_attachment7ParentInChar.position,
                                                                      _attachment7ParentInChar.rotation);
                        }
                    }
                }
                finally
                {
                    _updateBagTransformInfo.EndProfileOnlyEnableProfile();
                }

                try
                {
                    _updateMappingTransformInfo.BeginProfileOnlyEnableProfile();
                    if (null != _mappingBones)
                    {
                        foreach (var items in _mappingBones)
                        {
                            for (var i = 0; i < items.Value.Count; ++i)
                            {
                                var mapping = items.Value[i];
                                mapping.WardrobeBone.SetPositionAndRotation(mapping.CharacterBone.position,
                                                                            mapping.CharacterBone.rotation);
                            }
                        }
                    }
                }
                finally
                {
                    _updateMappingTransformInfo.EndProfileOnlyEnableProfile();
                }

                CalcCurrentLod();


                if (Input.GetKeyDown(KeyCode.P))
                {
                    foreach (var param in _wardrobes)
                    {
                        if (null == param || null == param.DefaultGameObject ||
                            null == param.DefaultGameObject.AsObject)
                        {
                            continue;
                        }
                        var level = MyLodGroup.GetLogLevel(param.DefaultGameObject);
                        Logger.InfoFormat("{0} lodLevel is : {1} ", param.DefaultGameObject.AsObject.name, level);
                    }
                }
            }
            finally
            {
                _mainInfo.EndProfileOnlyEnableProfile();
            }
        }