๋‚ด ์ธ์ƒ์—์„œ ๋ฏฟ์„ ๊ฑด ์˜ค์ง ๋‚˜ ์ž์‹ ๋ฟ!

The only one you can truly trust is yourself.

๊ฒŒ์ž„ ํ”„๋กœ๊ทธ๋ž˜๋ฐ/์œ ๋‹ˆํ‹ฐ ์—”์ง„(Unity)

์šด์„ธ ๋ฃฐ๋ › ์ด๋Œ€๋กœ ๋๋‚ด๊ธฐ๋Š” ์•„์‰ฌ์›Œ์„œ...

๐ŸŽฎinspirer9 2022. 9. 1. 22:55
728x90
๋ฐ˜์‘ํ˜•

๋ชฉ์ฐจ

    TextMesh(Legacy)

    • ์œ ๋‹ˆํ‹ฐ ๊ต๊ณผ์„œ 3์žฅ ์šด์„ธ ๋ฃฐ๋ › ์ด๋Œ€๋กœ ๋๋‚ด๊ธฐ๋Š” ์•„์‰ฌ์›Œ์„œ 6์นธ์— ๊ฑธ๋ฆฌ๋ฉด ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅํ•˜๋Š” ๊ฑฐ ํ•ด๋ณด๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ...
    • TextMesh๊ฐ€ TextMeshPro๋กœ ๋ฐ”๋€Œ์—ˆ๋‹ค.
      • ๋ญ”์ง€ ๋ชจ๋ฅด๊ฒ ์œผ๋‹ˆ ๊ทธ๋ƒฅ TextMesh(Legacy)๋ฅผ ์„ ํƒ
      • .text๋กœ ๊ธ€์ž๋ฅผ ๋ฐ”๊ฟ”๋ณด๊ณ ์ž ํ–ˆ์œผ๋‚˜ ์•ˆ๋ผ
        • ์™œ ์•ˆ๋ผ?
          • ์•”ํŠผ ์•ˆ๋ผ.
      • ๊ทธ๋ž˜์„œ ๊ทธ๋ƒฅ ๋ฏธ๋ฆฌ ๊ธ€์ž๋ฅผ ์ž…๋ ฅํ•ด๋‘๊ณ , ์˜ค๋ธŒ์ ํŠธ ์ขŒํ‘œ๋ฅผ ๋ฉ€๋ฆฌ ์ˆจ๊ฒผ๋‹ค๊ฐ€ ์ž ๊น ๊ฐ€์ ธ์˜ค๋Š” ๊ฑธ๋กœ ์ฒ˜๋ฆฌ

    ์˜ค๋ธŒ์ ํŠธ์˜ ํšŒ์ „ - ์ง๋ฒŒ๋ฝ

    • ์šด์„ธ ๋ฃฐ๋ ›์ด ๋Œ์•„์„œ 0~360๋„์— ๊ฑธ๋ฆฌ๋ฉด 60๋„ ๊ฐ„๊ฒฉ์œผ๋กœ ๋””๋ฒ„๊ทธ ๋ฉ”์‹œ์ง€๋ฅผ ์ฐ์–ด๋ดค๋Š”๋ฐ...
      • ๋ญ”๊ฐ€ ์˜ค๋ธŒ์ ํŠธ์— ๊ฑธ๋ฆฐ ๊ฑฐ๋ž‘ ๊ฐ๋„๋ž‘ ์•ˆ ๋งž๋Š”๋‹ค.
        • ์ด์ƒํ•˜๋‹ค.
          • ๊ทธ๋ƒฅ 0~60๋„ 60~120๋„๋Š” ์ž˜๋˜๊ณ , 120~180๋„๋Š” ์ž˜ ์•ˆ๋ผ.
          • ์ด์ƒํ•ด์„œ ์ธ์ŠคํŽ™ํ„ฐ ์ฐฝ์„ ๊ณ„์† ๋ณด๊ณ  ์žˆ๋Š”๋ฐ ์ง๋ฒŒ๋ฝ์ด๊ตฌ๋‚˜...
          • ๊ทผ๋ฐ EulerAngles๋กœ ๋ฆฌํ„ดํ•œ x์ถ• ์ขŒํ‘œ๋Š” ์ •์ƒ์ธ๋ฐ?
            • ์ด์ƒํ•˜๋‹ค.

    2D ์•ฑ์€ ์ฒ˜์Œ๋ถ€ํ„ฐ 2D๋กœ ๋งŒ๋“ค์ž

    • ๊ทธ๋ž˜์„œ ์•„... ์ด๊ฑฐ ์ฒจ๋ถ€ํ„ฐ 2D๋กœ ๋งŒ๋“ค๊ฑธ, ๋ฐ”๋ณด์ฒ˜๋Ÿผ 3D๋กœ ๋งŒ๋“ค์—ˆ๋‹ค.
      • ๋‚˜ ๋ฐ”๋ณธ๊ฐ€?
        • ๋‚˜ ๋ฐ”๋ณธ๊ฐ€ ๋ด...
      • ์œ ๋‹ˆํ‹ฐ๊ฐ€ ์ด์ƒํ•œ๊ฐ€?
        • ์œ ๋‹ˆํ‹ฐ๊ฐ€ ์ด์ƒํ•œ๊ฐ€ ๋ด
      • ์ด ์ƒ๊ฐ๋งŒ ํ•œ์ฐธ ํ–ˆ๋‹ค.

    Source Code

    • ์†Œ์Šค์ฝ”๋“œ๋„ ์ง€์ €๋ถ„... ใ…ก.ใ…ก;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class RouletteController : MonoBehaviour
    {
        float rotSpeed = 0f;
        bool isStoped = true;
        GameObject textbox;
        GameObject textbox2;
        GameObject[] textboxs;
    
        // Start is called before the first frame update
        void Start()
        {
            textbox = GameObject.FindWithTag("Text");
            textbox2 = GameObject.FindWithTag("Text2");
            //textboxs = GameObject.FindGameObjectsWithTag("Text");
            textbox.transform.position = new Vector3(-10f,-1.91655f,4.47f);
            textbox2.transform.position = new Vector3(-10f, -1.91655f, 4.47f);
        }
    
        // Update is called once per frame
        void Update()
        {
            if(Input.GetMouseButtonDown(0))
            {
                this.rotSpeed = 100 + Random.Range(0, 100);
                //Debug.Log(rotSpeed + " spin!");
                
                isStoped = false;
    
                textbox.transform.position = new Vector3(-10f, -1.91655f, 4.47f);
                textbox2.transform.position = new Vector3(-10f, -1.91655f, 4.47f);
            }
            
            transform.Rotate(0, this.rotSpeed, 0);
            
            this.rotSpeed *= 0.96f;
    
            if(this.rotSpeed < 0.001f && isStoped == false)
            {
                Vector3 v = this.transform.localEulerAngles;
                float f = v.x;
    
                if (0f <= f && f < 60f)
                {
                    Debug.Log(v + " ์šด์ˆ˜์ข‹์Œ");
                    textbox.transform.position = new Vector3(0.96f, -1.91655f, 4.47f);
                }
                else if (60f <= f && f < 120f)
                {
                    Debug.Log(v + " ์šด์ˆ˜๋‚˜์จ");
                    textbox2.transform.position = new Vector3(0.96f, -1.91655f, 4.47f);
                }
                else if (120f <= f && f < 180f)
                {
                    Debug.Log(v + " ์šด์ˆ˜๋Œ€ํ†ต");
                    textbox.transform.position = new Vector3(0.96f, -1.91655f, 4.47f);
                }
                else if (180f <= f && f < 240f)
                {
                    Debug.Log(v + " ์šด์ˆ˜๋งค์šฐ๋‚˜์จ");
                    textbox2.transform.position = new Vector3(0.96f, -1.91655f, 4.47f);
                }
                else if (240f <= f && f < 300f)
                {
                    Debug.Log(v + " ์šด์ˆ˜๋ณดํ†ต");
                }
                else if (300f <= f && f < 360f)
                {
                    Debug.Log(v + " ์šด์ˆ˜์กฐ์‹ฌ");
                } 
                isStoped = true;
            }
        }
    }

    ํฐ์— ๋„ฃ๊ณ  ํ…Œ์ŠคํŠธํ•˜๊ธฐ

    • ๊ทธ๋Ÿฌ๊ณ  ๋ณด๋‹ˆ ํฐ์— ๋„ฃ๊ณ  ํ…Œ์ŠคํŠธํ•˜๋Š” ๊ฑฐ๋‚˜ ํ•ด๋ด์•ผ๊ฒ ๋‹ค.
    • 3.7.3 ์•ˆ๋“œ๋กœ์ด๋“œ์— ๋นŒ๋“œํ•˜๊ธฐ (P.151)
    • Build Setting
      • Player Setting
        • Company Name๊ณผ Product Name์„ ๋„ฃ์—ˆ๋”๋‹ˆ
        • Package Name์€ ์ž๋™์œผ๋กœ ์ž…๋ ฅ๋˜์—ˆ๋‹ค.
    • ๋‹ค์‹œ Build Setting์—์„œ
      • Scene in Build์—์„œ SampleScene ์ฒดํฌ(์–ธ์ œ ํ–ˆ์ง€?)
      • ๊ทธ๋‹ค์Œ์— Build And Run ํ•˜๋ฉด, apk ์ €์žฅํ•  ๋””๋ ‰ํ„ฐ๋ฆฌ ์„ ํƒ.
        • ๊ทผ๋ฐ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€ ๋‚˜์˜ด. JDK ์„ค์น˜๊ฐ€ ์•ˆ๋˜์–ด ์žˆ์–ด์„œ ๋‚˜๋Š” ์˜ค๋ฅ˜.

    JDK ์„ค์น˜

    • JDK๋ฅผ ์„ค์น˜ํ•˜๋Ÿฌ ๊ฐ€์ฆˆ์•„!
      • Edit / Unity -> Preferences -> External Tools
        • ์ด๊ฑฐ ์„ค์น˜ ์ž๋™์œผ๋กœ ์•ˆ๋˜๋‚˜? ์™ ์ง€ UnityHub์—์„œ ๋  ๊ฒƒ ๊ฐ™์€๋ฐ?

    • Unity Hub๋กœ ๊ฐ€์ฆˆ์•„!
      • ์œ ๋‹ˆํ‹ฐ ๋ฒ„์ „ ์˜ค๋ฅธ์ชฝ์— ํ†ฑ๋‹ˆ๋ฐ”ํ€ด ๋ˆŒ๋Ÿฌ์„œ Add modules

    • Add modules for Unity 2021.3.8f1์—์„œ
      • Platforms -> Android Build Support
        • OpenJDK, Android SDK & NDK Tools ์„ค์น˜ ์ฒดํฌ -> Continue
        • (ํ•œ๊ตญ์–ด Preview๋„ ์„ค์น˜)
        • ์–ด? Visual Study Communioty 2019๋Š” ์™œ ์„ค์น˜๋˜๋Š” ๊ฑฐ์•ผ? 2021์ด ๊น”๋ ค์žˆ๋Š”๋ฐ???
          • ๋ช‡ ์‹ญ๋ถ„ ์ •๋„ ๊ธฐ๋‹ค๋ฆฌ๋ฉด ์„ค์น˜๋จ.

    • ๋‹ค ์„ค์น˜ํ•˜๊ณ  ๋‚˜๋ฉด ์—๋Ÿฌ ์•ˆ ๋œธ

    • ๋‹ค์‹œ Build Setting์œผ๋กœ ๊ฐ€์„œ Build And Run!
      • ๋˜ ์—๋Ÿฌ
        • ์œ ๋‹ˆํ‹ฐ ๋งค๋‰ด์–ผ์—์„œ Android environment setup์„ ์ฐพ์•„๋ณด๋ผ๊ณ  ํ•œ๋‹ค.

    ํฐ์— ์ง์ ‘ ์„ค์น˜ํ•˜๊ณ  ํ…Œ์ŠคํŠธ

    • ๊ทธ๋ƒฅ Build ํ•ด์„œ apk ํŒŒ์ผ ์ˆ˜๋™์œผ๋กœ ๋ณต๋ถ™ ํ•˜๊ณ ... ๋ณต์‚ฌ๊ฐ€ ์•ˆ๋˜๋„ค?

    • ์™œ ์•ˆ๋˜์ง€? ํ•˜๋ฉด์„œ ์—ฌ๋Ÿฌ ๋ฒˆ ํ•˜๊ณ , ์‚ฌ์ง„ ์ „์†ก ๋ชจ๋“œ, ํŒŒ์ผ ์ „์†ก๋ชจ๋“œ ๋ฐ”๊พธ๊ณ  ๋‹ค์‹œ ์ „์†กํ•ด๋ณด๋‹ˆ๊นŒ ๋˜๋„ค? ์•„ ๋ญ์•ผ.

    • ์ด๋ ‡๊ฒŒ ๋ณ„ ๊ฒƒ๋„ ์•„๋‹Œ ๊ฑฐ์— ์‹œ๊ฐ„์„ ๋บ๊ธฐ๋‹ค๋‹ˆ, ๋ฐ”๋ณธ๊ฐ€?

    728x90
    ๋ฐ˜์‘ํ˜•