Exemplo n.º 1
0
    private void ChooseBulletType(E_FireType type)
    {
        if (_player != null)
        {
            _player.WeaponAction -= Classic;
            _player.WeaponAction -= Alt_1;
            _player.WeaponAction -= Alt_2;
            _player.WeaponAction -= Alt_3;

            switch (type)
            {
            case E_FireType.CLASSIC:
                _player.WeaponAction += Classic;
                break;

            case E_FireType.ALT_1:
                _player.WeaponAction += Alt_1;
                break;

            case E_FireType.ALT_2:
                _player.WeaponAction += Alt_2;
                break;

            case E_FireType.ALT_3:
                _player.WeaponAction += Alt_3;
                break;

            default:
                break;
            }
        }
    }
Exemplo n.º 2
0
    void PlayShot_main()
    {
        if (_PlayerMeleeCheck != null)
        {
            bool b = _PlayerMeleeCheck.CheckMelee();
            if (b)
            {
                Shot_Melee();
            }
            else
            {
                Shot_Range();
            }
        }
        else
        {
            switch (_FireType)
            {
            case E_FireType.range:
                Shot_Range();
                break;

            case E_FireType.melee:
                Shot_Melee();
                _FireType = E_FireType.range;
                break;
            }
        }
    }
Exemplo n.º 3
0
    private void OnUpdate()
    {
        _direction = Vector3.zero;

        if (PlayerManager.Instance.Player != null)
        {
            if (Input.GetKey(_dataKeyCode.KeyForward))
            {
                _direction += PlayerManager.Instance.Player.transform.forward;
            }

            if (Input.GetKey(_dataKeyCode.KeyBack))
            {
                _direction += -PlayerManager.Instance.Player.transform.forward;
            }

            if (Input.GetKey(_dataKeyCode.KeyLeft))
            {
                _direction += -PlayerManager.Instance.Player.transform.right;
            }

            if (Input.GetKey(_dataKeyCode.KeyRight))
            {
                _direction += PlayerManager.Instance.Player.transform.right;
            }
        }

        if (_switchBulletType != null)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Ampersand))
            {
                CurrentFireType = E_FireType.CLASSIC;
            }
            else if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                CurrentFireType = E_FireType.ALT_1;
            }
            else if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.DoubleQuote))
            {
                CurrentFireType = E_FireType.ALT_2;
            }
            else if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Quote))
            {
                CurrentFireType = E_FireType.ALT_3;
            }
        }

        if (_interaction != null && Input.GetKeyDown(_dataKeyCode.KeyInteraction))
        {
            _interaction();
        }

        if (_pressSprint != null && Input.GetKeyDown(_dataKeyCode.KeySprint))
        {
            _pressSprint();
        }

        if (_releaseSprint != null && Input.GetKeyUp(_dataKeyCode.KeySprint))
        {
            _releaseSprint();
        }

        if (_throw != null && Input.GetMouseButtonDown(0))
        {
            _throw();
        }

        if (_movement != null && _direction != Vector3.zero)
        {
            _movement(_direction.normalized);
        }

        if (_idle != null && _direction == Vector3.zero)
        {
            _idle();
        }

        if (_gravity != null)
        {
            _gravity(_direction.normalized);
        }

        if (_changeInput != null)
        {
            _changeInput();
        }
    }
Exemplo n.º 4
0
 private void SetCurrentBulletType(E_FireType bulletType)
 {
     _currentBulletType = bulletType;
     _switchBulletType(_currentBulletType);
 }
Exemplo n.º 5
0
    void LoadData()
    {
        if (_HeroType == E_HeroType.main)
        {
            _slot_no = 1;
        }
        ST_S_unit_invenRec saveUnit = new ST_S_unit_invenRec();

        saveUnit = DataManager.Instance._SqlSavedata_unit_inven.Get_All_From_slot_no(_slot_no);
        if (saveUnit.idx > 0)
        {
            GameObject prefab = GameWorld.Instance._UnitList.GetPrefab_Unit(saveUnit.unit_code);
            if (prefab)
            {
                GameObject childObj = (GameObject)Instantiate(prefab);
                if (_HeroType == E_HeroType.sub && _JointRoot != null)
                {
                    _JointRoot.parent         = null;
                    childObj.transform.parent = _JointRoot;
                }
                else
                {
                    childObj.transform.parent = this.transform;
                }

                childObj.transform.localPosition = new Vector3(0f, 0f, 0f);
                childObj.transform.localScale    = new Vector3(1f, 1f, 1f);
                _UnitRoot = childObj.transform;

                _UnitInfo      = _UnitRoot.GetComponentInChildren <UnitInfo>();
                _AniController = _UnitRoot.GetComponentInChildren <wt_AnimationController>();

                _UnitInfo._Table_idx = saveUnit.idx;
                _UnitInfo._unit_code = saveUnit.unit_code;
                _UnitInfo._ClassNo   = saveUnit.class_no;
                _UnitInfo._Level     = DataManager.Instance.GetUnitLevel(_UnitInfo._Table_idx.ToString(), _UnitInfo._ClassNo);
                _UnitInfo._TotalExp  = DataManager.Instance._SqlSavedata_unit_inven.Get_total_exp(_UnitInfo._Table_idx.ToString());

                _FireType = _UnitInfo._FireType;
            }
            else
            {
                NGUIDebug.Log("Error LoadData() -- GetPrefab_Unit");
            }
        }
        else
        {
            NGUIDebug.Log("Error LoadData() 1");
        }

        ST_B_UnitRec balanceUnit = new ST_B_UnitRec();

        balanceUnit = DataManager.Instance._SqlBalance_unit.Get_UnitRec(_UnitInfo._unit_code, _UnitInfo._Level, _UnitInfo._ClassNo);
        if (balanceUnit.class_no > 0)
        {
            _UnitInfo._HP_Default = _UnitInfo._HP = balanceUnit.hp;
            _UnitInfo._Attack     = balanceUnit.attack;
        }
        else
        {
            Debug.Log("Error LoadData() 2-->" + "," + _UnitInfo._unit_code + "," + _UnitInfo._Level + "," + _UnitInfo._ClassNo);
        }

        if (_HeroType == E_HeroType.sub)
        {
            /* 타입별로 포지션 정해지게끔 수정 함.
             *         Vector2 pos = DataManager.Instance.Get_pos_slot(_slot_no);
             *         this.transform.localPosition = pos;
             *         Collider2D col = GetComponentInChildren <Collider2D>();
             *         if(col)
             *         {
             *             Debug.Log("~~~~~~~ " + col.gameObject.name);
             *             col.enabled = true;
             *         }
             * */
        }
    }