Esempio n. 1
0
        public void ChangeToNextWeapon(bool isLeft)
        {
            states.isTwoHanded = false;
            states.HandleTwoHanded();

            if (isLeft)
            {
                if (r_l_weapons.Count == 0)
                {
                    return;
                }

                if (l_index < r_l_weapons.Count - 1)
                {
                    l_index++;
                }
                else
                {
                    l_index = 0;
                }

                EquipWeapon(r_l_weapons[l_index], true);
            }
            else
            {
                if (r_r_weapons.Count == 0)
                {
                    return;
                }

                if (r_index < r_r_weapons.Count - 1)
                {
                    r_index++;
                }
                else
                {
                    r_index = 0;
                }

                EquipWeapon(r_r_weapons[r_index]);
            }

            states.actionManager.UpdataActionsOneHanded();
        }
Esempio n. 2
0
        void UpdateStates()
        {
            states.horizontal = horizontal;
            states.vertical   = vertical;

            Vector3 v = vertical * camManager.transform.forward;
            Vector3 h = horizontal * camManager.transform.right;

            states.moveDir = (v + h).normalized;
            float m = Mathf.Abs(horizontal) + Mathf.Abs(vertical);

            states.moveAmout = Mathf.Clamp01(m);

            if (x_input)
            {
                b_input = false;
            }

            if (b_input && b_timer > 0.5f)
            {
                states.run = (states.moveAmout > 0) && states.characterStats._stamina > 0;
            }

            if (b_input == false && b_timer > 0 && b_timer < 0.5f)
            {
                states.rollInput = true;
            }

            states.itemInput = x_input;
            states.rt        = rt_input;
            states.lt        = lt_input;
            states.rb        = rb_input;
            states.lb        = lb_input;

            if (y_input)
            {
                states.isTwoHanded = !states.isTwoHanded;
                states.HandleTwoHanded();
            }

            if (states.lockonTarget != null)
            {
                if (states.lockonTarget.eState.isDead)
                {
                    states.lockOn           = false;
                    states.lockonTarget     = null;
                    states.lockOnTransform  = null;
                    camManager.lockon       = false;
                    camManager.lockonTarget = null;
                }
            }
            else
            {
                states.lockOn           = false;
                states.lockonTarget     = null;
                states.lockOnTransform  = null;
                camManager.lockon       = false;
                camManager.lockonTarget = null;
            }

            if (rightAxis_down)
            {
                states.lockOn = !states.lockOn;

                states.lockonTarget = EnemyManager.singleton.GetEnemy(transform.position);
                if (states.lockonTarget == null)
                {
                    states.lockOn = false;
                }

                camManager.lockonTarget    = states.lockonTarget;
                states.lockOnTransform     = states.lockonTarget.GetTarget();
                camManager.lockonTransform = states.lockOnTransform;
                camManager.lockon          = states.lockOn;
            }
        }