コード例 #1
0
    static void ResetViewRoot()
    {
        GameObject[] selectedObjArray = Selection.gameObjects;

        for (int i = 0; i < selectedObjArray.Length; ++i)
        {
            BiologyViewRoot viewRoot = selectedObjArray[i].GetComponent <BiologyViewRoot>();

            if (null == viewRoot)
            {
                viewRoot = Undo.AddComponent <BiologyViewRoot>(selectedObjArray[i]);
            }

            viewRoot.Reset();
            UnityEditor.EditorUtility.SetDirty(selectedObjArray[i]);
        }
    }
コード例 #2
0
        void IPeMsg.OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.View_Prefab_Build:
            {
                BiologyViewRoot viewRoot = (BiologyViewRoot)args[1];
                _boneCollector = (args[0] as BiologyViewCmpt).monoBoneCollector;
                _modelCmpt     = viewRoot.armorBones;
                if (_armorObjects != null)
                {
                    for (int i = 0; i < _armorObjects.Count; i++)
                    {
                        _armorObjects[i].CreateModel();
                    }
                }
                break;
            }

            case EMsg.Battle_BeAttacked:
            {
                int selected = SelectArmorPartToAttack();
                if (selected >= 0)
                {
                    _armorObjects[selected].OnBeAttacked((float)args[0] * PEVCConfig.instance.armorDamageRatio, (SkillSystem.SkEntity)args[1]);
                }
                break;
            }

            case EMsg.View_FirstPerson:
            {
                if ((bool)args[0] != _isFirstPersonMode)
                {
                    _isFirstPersonMode = !_isFirstPersonMode;
                    if (_armorObjects != null)
                    {
                        for (int i = 0; i < _armorObjects.Count; i++)
                        {
                            _armorObjects[i].SyncModelFirstPersonMode();
                        }
                    }
                }
                break;
            }
            }
        }