Exemple #1
0
        public void WearCloth(ClothItem c)
        {
            Debug.Log(c);
            SMeshHolder m = GetMeshHolder(c.bodyPart);

            m.meshRenderer.sharedMesh = c.mesh;
            m.meshRenderer.material   = c.material;
            m.meshRenderer.enabled    = true;
        }
        public void LoadCharacterModel(string modelId)
        {
            ClothItem c = GameManagers.GetResourcesManager().GetClothItem(modelId);

            if (characterHook == null)
            {
                InitReferences();
            }
            characterHook.Init(c);
        }
Exemple #3
0
        public ClothItem SetWearedCloth(string id, ResourcesManager rm, StateManager states)
        {
            Item item = rm.GetItemInstance(id);

            if (item != null)
            {
                ClothItem c = (ClothItem)item;
                states.character.WearCloth(c);
                return(c);
            }
            return(null);
        }
Exemple #4
0
 public void Init(ClothItem clothItem)
 {
     body.meshRenderer.sharedMesh = clothItem.mesh;
     body.meshRenderer.material   = clothItem.material;
 }
Exemple #5
0
        public override void Execute(StateManager states)
        {
            onGame.Raise();
            if (states.profile == null)
            {
                return;
            }
            states.itemsDirty = true;
            states.isPlayer   = true;
            if (states.playerStatsManager == null)
            {
                states.playerStatsManager = Resources.Load("Player Stats") as PlayerStatsManager;
            }
            states.profile.SetStatsToStaringValue();
            ResourcesManager rm = GameManager.GetResourcesManager();

            states.inventory.unarmedWeapon.Init();
            states.inventory.unarmedWeapon.runtime.modelInstance.SetActive(false);

            for (int i = 0; i < states.profile.rightHandWeapons.Length; i++)
            {
                Item rh = rm.GetItemInstance(states.profile.rightHandWeapons[i]);
                if (rh != null)
                {
                    if (i > states.inventory.rightHandSlots.Length - 1)
                    {
                        break;
                    }
                    Weapon rhWeapon = (Weapon)rh;

                    states.inventory.rightHandSlots[i] = rhWeapon;
                    changeWeaponAction.Execute(states, false);
                }
            }
            //Get item on right hand according to profile

            Debug.Log("LEFT HAND");
            for (int i = 0; i < states.profile.leftHandSlots.Length; i++)
            {
                //Get item on left hand according to profile
                Item lh = rm.GetItemInstance(states.profile.leftHandSlots[i]);
                if (lh != null)
                {
                    Weapon lhWeapon = (Weapon)lh;
                    if (i > states.inventory.leftHandSlots.Length - 1)
                    {
                        break;
                    }
                    states.inventory.leftHandSlots[i] = lhWeapon;
                    changeWeaponAction.Execute(states, true);
                }
            }

            for (int i = 0; i < states.profile.spellId.Length; i++)
            {
                Item spell = rm.GetItemInstance(states.profile.spellId[i]);
                if (spell != null)
                {
                    Spell s = (Spell)spell;
                    states.inventory.SetSpell(s, true);
                }
            }


            states.character = states.activeModel.GetComponent <CharacterViz>();
            states.character.SetToDefault();

            for (int i = 0; i < states.profile.wearedClothItems.Length; i++)
            {
                ClothItem item = states.SetWearedCloth(states.profile.wearedClothItems[i], rm, states);
                if (item != null)
                {
                    states.inventory.cloths.Add(item);
                }
            }
        }