예제 #1
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);
        }
예제 #2
0
        public static void DeepCopyAction(Weapen w, ActionInput inp, ActionInput assign, List <Action> actionSlots, bool isLeftHand = false)
        {
            Action a   = GetAction(assign, actionSlots);
            Action w_a = w.GetAction(w.actions, inp);

            if (w_a == null)
            {
                return;
            }
            a.targetAnim    = w_a.targetAnim;
            a.spellClass    = w_a.spellClass;
            a.type          = w_a.type;
            a.canBenParried = w_a.canBenParried;
            a.changeSpeed   = w_a.changeSpeed;
            a.animSpeed     = w_a.animSpeed;
            a.canBackstab   = w_a.canBackstab;
            if (isLeftHand)
            {
                a.mirror = true;
            }
            a.overrideDamageAnim = w_a.overrideDamageAnim;
            a.damageAnim         = w_a.damageAnim;
            a.parryMultiplier    = w.parryMultiplier;
            a.backstabMultiplier = w.backstabMultiplier;
            a.canParry           = w_a.canParry;
            DeepCopyWeapenStats(w_a.weapenStats, a.weapenStats);
        }
예제 #3
0
 public static void DeepCopyWeapen(Weapen from, Weapen to)
 {
     to.icon    = from.icon;
     to.oh_idle = from.oh_idle;
     to.th_idle = from.th_idle;
     to.actions = new List <Action>();
     for (int i = 0; i < from.actions.Count; i++)
     {
         Action a = new Action();
         a.weapenStats = new WeapenStats();
         DeepCopyActionToAction(a, from.actions[i]);
         to.actions.Add(a);
     }
     to.two_handenActions = new List <Action>();
     for (int i = 0; i < from.two_handenActions.Count; i++)
     {
         Action a = new Action();
         a.weapenStats = new WeapenStats();
         DeepCopyActionToAction(a, from.actions[i]);
         to.two_handenActions.Add(a);
     }
     to.parryMultiplier    = from.parryMultiplier;
     to.backstabMultiplier = from.backstabMultiplier;
     to.leftHandMirror     = from.leftHandMirror;
     to.modelPrefab        = from.modelPrefab;
     to.l_model_pos        = from.l_model_pos;
     to.l_model_eulers     = from.l_model_eulers;
     to.r_model_pos        = from.r_model_pos;
     to.r_model_eulers     = from.r_model_eulers;
     to.model_scale        = from.model_scale;
 }
예제 #4
0
        public void HandleTwoHanded()
        {
            bool   isRight = true;
            Weapen w       = inventoryManager.rightHandWeapen.instance;

            if (w == null)
            {
                w       = inventoryManager.leftHandWeapen.instance;
                isRight = false;
            }
            if (w == null)
            {
                return;
            }
            if (isTwoHanded)
            {
                anim.CrossFade(w.th_idle, 0.2f);
                actionManager.UpdateActionsTwoHanded();
                if (isRight)
                {
                    if (inventoryManager.leftHandWeapen)
                    {
                        inventoryManager.leftHandWeapen.weapenModel.SetActive(false);
                    }
                }
                else
                {
                    if (inventoryManager.rightHandWeapen)
                    {
                        inventoryManager.rightHandWeapen.weapenModel.SetActive(false);
                    }
                }
            }
            else
            {
                anim.Play(StaticStrings.changeWeapen);
                anim.Play(StaticStrings.emptyBoth);
                actionManager.UpdateActionsOneHanded();
                if (isRight)
                {
                    if (inventoryManager.leftHandWeapen)
                    {
                        inventoryManager.leftHandWeapen.weapenModel.SetActive(true);
                    }
                }
                else
                {
                    if (inventoryManager.rightHandWeapen)
                    {
                        inventoryManager.rightHandWeapen.weapenModel.SetActive(true);
                    }
                }
            }
        }
예제 #5
0
        public void UpdateActionsTwoHanded()
        {
            EmptyAllSlots();
            Weapen w = states.inventoryManager.rightHandWeapen.instance;

            for (int i = 0; i < w.two_handenActions.Count; i++)
            {
                Action a = StaticFunctions.GetAction(w.two_handenActions[i].input, actionSlots);
                a.targetAnim = w.two_handenActions[i].targetAnim;
                a.type       = w.two_handenActions[i].type;
            }
        }