Exemplo n.º 1
0
    private void GenerateSkin(CharacterSkin skin)
    {
        var index = Random.Range(0, _skinKeys.Count);
        var key   = _skinKeys[index];

        _skinKeys.RemoveAt(index);

        if (key.GlassesId != -1)
        {
            Instantiate(CharacterGlassesCollection.List[key.GlassesId], skin.transform);
        }

        if (key.HatId != -1)
        {
            Instantiate(CharacterHatCollection.List[key.HatId], skin.transform);
        }

        if (key.MouthId != -1)
        {
            Instantiate(CharacterMouthCollection.List[key.MouthId], skin.transform);
        }

        var material = Instantiate(TeeShirt);

        material.color             = CharacterColorCollection.List[key.ColorId];
        skin.MeshRenderer.material = material;
    }
Exemplo n.º 2
0
 public void InitData()
 {
     characterSkin  = new CharacterSkin(this);
     characterEquip = new CharacterEquip(this);
     characterAnim  = new CharacterAnim(this);
     CharacterItems = new CharacterItems(this);
 }
Exemplo n.º 3
0
 public void SetSkin(CharacterSkin skin)
 {
     cosmetics.Find("Face").GetComponent <SpriteMeshInstance>().spriteMesh          = skin.Face;
     cosmetics.Find("Chest").GetComponent <SpriteMeshInstance>().spriteMesh         = skin.Chest;
     cosmetics.Find("Hip").GetComponent <SpriteMeshInstance>().spriteMesh           = skin.Hip;
     cosmetics.Find("LeftShoulder").GetComponent <SpriteMeshInstance>().spriteMesh  = skin.LeftShoulder;
     cosmetics.Find("LeftArm").GetComponent <SpriteMeshInstance>().spriteMesh       = skin.LeftArm;
     cosmetics.Find("LeftHand").GetComponent <SpriteMeshInstance>().spriteMesh      = skin.LeftHand;
     cosmetics.Find("Fingers").GetComponent <SpriteMeshInstance>().spriteMesh       = skin.Fingers;
     cosmetics.Find("RightShoulder").GetComponent <SpriteMeshInstance>().spriteMesh = skin.RightShoulder;
     cosmetics.Find("RightArm").GetComponent <SpriteMeshInstance>().spriteMesh      = skin.RightArm;
     cosmetics.Find("RightHand").GetComponent <SpriteMeshInstance>().spriteMesh     = skin.RightHand;
     cosmetics.Find("LeftThigh").GetComponent <SpriteMeshInstance>().spriteMesh     = skin.LeftThigh;
     cosmetics.Find("LeftLeg").GetComponent <SpriteMeshInstance>().spriteMesh       = skin.LeftLeg;
     cosmetics.Find("LeftFoot").GetComponent <SpriteMeshInstance>().spriteMesh      = skin.LeftFoot;
     cosmetics.Find("RightThigh").GetComponent <SpriteMeshInstance>().spriteMesh    = skin.RightThigh;
     cosmetics.Find("RightLeg").GetComponent <SpriteMeshInstance>().spriteMesh      = skin.RightLeg;
     cosmetics.Find("RightFoot").GetComponent <SpriteMeshInstance>().spriteMesh     = skin.RightFoot;
 }
    public CharacterParameterBasis(ICharacterBasisParameter basisparam)
        : base(basisparam)
    {
        BasisParameter = basisparam;
        CurrentBuffs = new List<StatusBuffBasis>();
        Offset = new ParameterOffset();
        Inventory = new ItemInventory(basisparam.InventorySize);
        CurrentExp = 0;
        CurrentActionSpeed = BasisParameter.ActionSpeed;
        CurrentLevel = 1;
        MaxHP = basisparam.InitHP;
        CurrentHP = MaxHP;
        WallPenatrableThrow = false;
        MaxSTR = basisparam.STR;
        CurrentSTR = MaxSTR;

        Skin = new CharacterSkin(this.BasisParameter);//(basisparam.SpritePath, basisparam.AnimatorControllerPath);
        if(TalkTextPath.Length!=0)TalkText = TalkXMLReder.loadXML(TalkTextPath);
    }
Exemplo n.º 5
0
        void AddSkinToCharacter(GameObject player1)
        {
            CharacterSkin currentCharacterSkin = player1.GetComponent <CharacterSkin>();

            if (currentCharacterSkin != null && StaticData.CanLoadSkin())
            {
                Transform[] amounts = new Transform[(int)SkinPartType.Max];
                var         rigbods = player1.transform.Find("Rigidbodies");
                if (rigbods != null)
                {
                    int max = (int)SkinPartType.Max;
                    amounts = new Transform[max];
                    for (int i = 1; i < max; i++)
                    {
                        SkinPartType partType = (SkinPartType)i;
                        amounts[i] = rigbods.Find(partType.ToString());
                        if (amounts[i] == null)
                        {
                            //Debug.LogError("CharacterSkin can not find this part " + partType);
                        }
                    }
                }
                var typetoskin = StaticData.GetSelfSkins();
                for (int i = 1; i < (int)Skin.SkinPartType.Max; i++)
                {
                    if (typetoskin[i] != null)
                    {
                        foreach (var id in typetoskin[i])
                        {
                            currentCharacterSkin.LoadSkinPart(i, id);
                        }
                    }
                }
            }
            var controller = player1.GetComponent <PlayerRootScript>();
            //controller.SetLineRendererVisible(StaticData.LineRendererVisible);
            short visibleValue = currentCharacterSkin.GetJointVisibleValue();

            controller.SetJointRendererVisible(visibleValue);
        }
Exemplo n.º 6
0
    public void SetSkin(string skin_name)
    {
        string modelname = Animation.gameObject.name;

        if (Array.Exists(Skins, s => string.Compare(s, skin_name, true) == 0) == false)
        {
            throw new System.Exception(string.Format("[{0}] skin failed : {1}", modelname, skin_name));
        }

        if (CurrentSkin != null && CurrentSkin.IsInit == true)
        {
            CurrentSkin.Free();
        }

#if UNITY_EDITOR
#if SH_ASSETBUNDLE
        CharacterSkin prefab      = null;
        string        prefab_path = string.Format("Assets/Character_Skin/{0}_skin_{1}.prefab", modelname, skin_name);
        prefab = AssetDatabase.LoadAssetAtPath <CharacterSkin>(prefab_path);
        if (EditorApplication.isPlaying == false)
        {
            EditorUtility.SetDirty(gameObject);
        }
        CurrentSkin = new AssetContainer <CharacterSkin>(new AssetData(prefab.gameObject));
#else
        CurrentSkin = AssetManager.GetCharacterSkinAsset(modelname, skin_name);
#endif
#endif

        CurrentSkin.Alloc();
        CurrentSkin.Asset.transform.SetParent(Animation.transform, false);
        CurrentSkin.Asset.gameObject.name = skin_name;
        CurrentSkin.Asset.Init(RootBone, m_Bones);

        SetMaterialDefault();
    }
 public void ChangeAnimator(int id)
 {
     skin = GameManager.Manager.playerSkins[id];
     GetComponent <Animator>().runtimeAnimatorController = skin.runtimeAnimator;
     animator = GetComponent <Animator>();
 }
 public void ChangeAnimator(CharacterSkin characterSkin)
 {
     skin = characterSkin;
     GetComponent <Animator>().runtimeAnimatorController = skin.runtimeAnimator;
     animator = GetComponent <Animator>();
 }
 public DebugCharacterParameter()
     : base(new BP_TestNPC())
 {
     Skin = new CharacterSkin("", "");
 }