Exemplo n.º 1
0
    private void SetWeaponInfo(WeaponScript weapon)
    {
        switch (conWeaponType)
        {
        case Weapontype.None:
            swingWeapon    = null;
            shootingWeapon = null;
            throwingWeapon = null;
            break;

        case Weapontype.Swing:
            swingWeapon    = (SwingWeaponScript)weapon;
            shootingWeapon = null;
            throwingWeapon = null;
            break;

        case Weapontype.Shooting:
            swingWeapon    = null;
            shootingWeapon = (ShootingWeaponScript)weapon;
            throwingWeapon = null;
            break;

        case Weapontype.Throwing:
            swingWeapon    = null;
            shootingWeapon = null;
            throwingWeapon = (ThrowingWeaponScript)weapon;
            break;
        }
    }
Exemplo n.º 2
0
    private void AttackEnd()
    {
        if (canContinuousAttack && !isFinishAttackDelay)
        {
            // 무기 타입에 따라..
            switch (conWeaponType)
            {
            // 무기가 없다.(주먹질)
            case Weapontype.None:

                // 앞으로 조금 이동
                attackMovingCoroutine = StartCoroutine(AttackMovingCoroutine(0.3f, false));

                // 공격
                animator.SetTrigger("Punch");

                break;


            // 몽둥이, 검 등의 무기
            case Weapontype.Swing:

                // 무기 파괴 유무 검사
                if (swingWeapon.conUsing <= 0)
                {
                    // 파괴 이펙트 생성
                    GameObject temp = ObjectPullManager.Instance.GetInstanceByName("WeaponBreaking");
                    temp.transform.position = swingWeapon.transform.position + temp.transform.position;
                    temp.SetActive(true);

                    // 무기 파괴
                    swingWeapon.transform.SetParent(cantUseWeaponParent);
                    swingWeapon.transform.localPosition = Vector3.zero;
                    swingWeapon.gameObject.SetActive(false);
                    swingWeapon.DestroyWeapon();
                    swingWeapon = null;

                    // 현재 가지는 무기 정보 초기화
                    conWeaponType = Weapontype.None;

                    // slot을 비운다.
                    weaponSlotManager.ResetWeapon();

                    if (FinishAttackDelayCoroutine == null)
                    {
                        FinishAttackDelayCoroutine = StartCoroutine(AttackFinishCoroutine());
                    }

                    attackHitArea.CloseHitAreaOff();

                    // 이동 시작
                    MoveStart();
                }
                else
                {
                    // 그 외엔 조금 이동
                    attackMovingCoroutine = StartCoroutine(AttackMovingCoroutine(0.5f, false));

                    // 공격
                    animator.SetTrigger("Swing");
                }
                break;
            }
        }
        // 공격 마무리
        else
        {
            // 무기 타입에 따라..
            switch (conWeaponType)
            {
            // 무기가 없다.(주먹질)
            case Weapontype.None:

                if (FinishAttackDelayCoroutine != null)
                {
                    FinishAttackDelayCoroutine = StartCoroutine(AttackFinishCoroutine());
                }

                // 공격 판정 범위 Off
                attackHitArea.CloseHitAreaOff();

                // 이동 시작
                MoveStart();

                break;


            // 몽둥이, 검 등의 무기
            case Weapontype.Swing:

                if (swingWeapon.conUsing <= 0)
                {
                    // 파괴 이펙트 생성
                    GameObject temp = ObjectPullManager.Instance.GetInstanceByName("WeaponBreaking");
                    temp.transform.position = swingWeapon.transform.position + temp.transform.position;
                    temp.SetActive(true);

                    // 무기 파괴
                    swingWeapon.transform.SetParent(cantUseWeaponParent);
                    swingWeapon.transform.localPosition = Vector3.zero;
                    swingWeapon.gameObject.SetActive(false);
                    swingWeapon.DestroyWeapon();
                    swingWeapon = null;

                    // 현재 가지는 무기 정보 초기화
                    conWeaponType = Weapontype.None;

                    // slot을 비운다.
                    weaponSlotManager.ResetWeapon();
                }
                else
                {
                    // Trail Off
                    swingWeapon.TrailOff();
                }

                if (FinishAttackDelayCoroutine == null)
                {
                    FinishAttackDelayCoroutine = StartCoroutine(AttackFinishCoroutine());
                }

                // 공격 판정 범위 Off
                attackHitArea.CloseHitAreaOff();

                // 이동 시작
                MoveStart();

                break;

            // 총 등의 무기
            case Weapontype.Shooting:

                shootingWeapon.ContinuousAttackEnd();

                // 이동 시작
                MoveStart();

                break;
            }
        }
    }