Пример #1
0
    private void ArmWeapon()
    {
        Transform weapon;

        WeaponScript conWeapon = GetWeaponScript();

        // 현재 무기를 가지고 있다면
        if (conWeaponType != Weapontype.None)
        {
            // 사용하던 무기를 바닥에 놓는다.
            weapon = conWeapon.GetComponent <Transform>();
            weapon.SetParent(droppedWeaponParent);
            weapon.position = transform.position + transform.forward * 0.5f;
            weapon.rotation = Quaternion.Euler(0, transform.rotation.eulerAngles.y, 0);

            // 무기를 최초 상태로 초기화
            conWeapon.ResetOwner();
            conWeapon.ChangeToDrop();
        }

        // 플레이어가 가지는 무기 정보를 새로운 무기 정보로 변경
        conWeapon     = DropObjectScript.dropObject;
        conWeaponType = conWeapon.weaponType;
        SetWeaponInfo(conWeapon);
        weaponAudio.clip = conWeapon.weaponUsingSound;

        // 무기의 상태 및 정보를 플레이어가 가지는 상태로 변경
        conWeapon.SetOwner(this);
        conWeapon.ChangeToEquiped();

        // 새로운 무기를 손으로 이동
        weapon = conWeapon.transform;
        weapon.SetParent(handlingWeaponParent, true);
        weapon.localPosition = Vector3.zero;
        weapon.localRotation = Quaternion.Euler(0, 0, 0);
    }