Ejemplo n.º 1
0
        public void EquipeWeapen(RuntimeWeapen w, bool isLeft)
        {
            if (isLeft)
            {
                if (leftHandWeapen != null)
                {
                    leftHandWeapen.weapenModel.SetActive(false);
                }
                leftHandWeapen = w;
            }
            else
            {
                if (rightHandWeapen != null)
                {
                    rightHandWeapen.weapenModel.SetActive(false);
                }
                rightHandWeapen = w;
            }

            string targetIdle = w.instance.oh_idle;

            targetIdle += isLeft ? "_l" : "_r";
            states.anim.SetBool(StaticStrings.mirror, isLeft);
            states.anim.Play(StaticStrings.changeWeapen);
            states.anim.Play(targetIdle);

            UI.QuickSlot uiSlot = UI.QuickSlot.singleton;
            uiSlot.UpdateSlot(isLeft?UI.QSlotType.lh:UI.QSlotType.rh, w.instance.icon);

            w.weapenModel.SetActive(true);
        }
Ejemplo n.º 2
0
        public RuntimeWeapen WeapenToRuntimeWeapen(Weapen w, bool isLeft = false)
        {
            GameObject    go   = new GameObject();
            RuntimeWeapen inst = go.AddComponent <RuntimeWeapen>();

            inst.instance = new Weapen();
            StaticFunctions.DeepCopyWeapen(w, inst.instance);
            go.name          = w.itemName;
            inst.weapenModel = Instantiate(inst.instance.modelPrefab) as GameObject;
            Transform p = states.anim.GetBoneTransform(isLeft ? HumanBodyBones.LeftHand : HumanBodyBones.RightHand);

            inst.weapenModel.transform.parent           = p;
            inst.weapenModel.transform.localPosition    = isLeft?inst.instance.l_model_pos:inst.instance.r_model_pos;
            inst.weapenModel.transform.localEulerAngles = isLeft?inst.instance.l_model_eulers:inst.instance.r_model_eulers;
            inst.weapenModel.transform.localScale       = inst.instance.model_scale;
            inst.w_hook = inst.weapenModel.GetComponentInChildren <WeapenHook>();
            inst.w_hook.InitDamageColliders(states);

            if (isLeft)
            {
                r_l_weapens.Add(inst);
            }
            else
            {
                r_r_weapens.Add(inst);
            }
            inst.weapenModel.SetActive(false);
            return(inst);
        }
Ejemplo n.º 3
0
        private void LoadInventory(StateManager st)
        {
            for (int i = 0; i < rh_weapens.Count; i++)
            {
                WeapenToRuntimeWeapen(ResourcesManager.singleton.GetWeapen(rh_weapens[i]));
            }
            for (int i = 0; i < lh_weapens.Count; i++)
            {
                WeapenToRuntimeWeapen(ResourcesManager.singleton.GetWeapen(lh_weapens[i]), true);
            }
            if (r_r_weapens.Count > 0)
            {
                if (r_index > r_r_weapens.Count - 1)
                {
                    r_index = 0;
                }

                rightHandWeapen = r_r_weapens[r_index];
            }
            if (r_l_weapens.Count > 0)
            {
                if (l_index > r_l_weapens.Count - 1)
                {
                    l_index = 0;
                }

                leftHandWeapen = r_l_weapens[l_index];
            }
            for (int i = 0; i < spell_items.Count; i++)
            {
                SpellToRuntimeSpell(ResourcesManager.singleton.GetSpell(spell_items[i]));
            }
            if (r_spells.Count > 0)
            {
                EquipSpell(r_spells[0]);
            }

            if (rightHandWeapen != null)
            {
                EquipeWeapen(rightHandWeapen, false);
            }

            if (leftHandWeapen != null)
            {
                hasLeftHandWeapen = true;
                EquipeWeapen(leftHandWeapen, true);
            }

            InitAllDamageColliders(st);
            CloseAllDamageColliders();
        }