목록BCA/4. Unity (25)
VioletaBabel
--방법 1Camera랑 Render Texture를 하나 만든다.미니맵 용 카메라는 Depth를 main Camera보다 낮춘 후, 미니맵 용 카메라에 Viewport Rect를 조정한다.orthographic으로 할 것.지형지물을 컨트롤+D로 복사 후, 레이어를 새로 하나 만들어 넣어준다(Minimap)그리고 미니맵 출력용 카메라의 Culling Mask를 그 레이어로 해둔다. --방법 2위와 비슷하게 가나, Render Texture를 하나 만든다.카메라의 Target Texture에 그 렌더 텍스쳐를 넣어준다.캔버스를 만들고 그 자식으로 게임 오브젝트를 만들어 mask와 image를 컴포넌트로 넣어준다.image의 source image는 동그란 원을 넣는다.그리고 자식으로도 게임 오브젝트를 하나..
아직 채팅 기능은 없으나, 서버 연결만 확인해보기 http://violetababel.tistory.com/413 의 서버 부분은 그대로 사용.서버를 켜고 스타트를 누른 후유니티에 다음 코드를 짜서 넣어둔다. 123456789101112131415161718192021222324252627282930313233//ChatClient.csusing System.Collections;using System.Collections.Generic;using UnityEngine;using WebSocketSharp; public class ChatClient : MonoBehaviour{ WebSocket mWebSocket; int i = 0; // Use this for initialization void S..
Terrain으로 길을 깔고 장애물 등을 배치한 후 Window의 Navigation을 누른다. Terrain에는 Navigation-Object를 누른 후 Navigation Static과 Generate Offmeshlinks를 체크하고 Navigation Area를 Walkable로 바꾼다. 그 외 장애물에는 navigation Static만 체크하고 Navigation Area를 Not Walkable로 한다. 계단이 있는 곳이나 지나갈 수 있는 장애물(다리 등)은 Navigation Static만 체크하고 Navigation Area를 Walkable로 한다. 그리고 계단 등도 지나갈 수 있도록 Bake 항목의 Step Height는 0.75로 한다. 나중에 점프와 추락을 만들기 위해 Bake ..
Plane 위에 cube를 두고, cube에 이 스크립트와 rigidbody를 넣는다. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778using System.Collections;using System.Collections.Generic;using UnityEngine;using DG.Tweening; public class cubeMove : MonoBehaviour{ Vector3 dest; bool click = false; // Use this for initialization voi..
타워디펜스 길 찍은 툴 : http://violetababel.tistory.com/409 그냥 닷넷제이슨 에셋에 쑤셔넣으면 빌드하고나면 문제가 되더라에셋스토어에서 JSON .NET For Unity (PARENTELEMENT, LLC꺼) 넣어서 아래처럼 하니까 잘 되었음 (만들고 불러오는거 둘 다 보려면 DataUI.cs 볼 것) 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364//UpgradeButtonScript.csusing UnityEngine; public class UpgradeButtonScript : MonoBehaviour{..
Main Camera에 LoadData.cs를 넣고, imageObject에 GameObject라는 프리팹(스프라이트 렌더러를 가짐)을, Dialog에는 Dialog라는 프리팹, TextObject에는 New Text를 넣어준다(여기서 나머지는 empty object지만 new text는 3d text임을 유의) 넣어준다. 그리고 글씨가 확실히 앞에 있게하기 위해 New Text에만 z값을 -1로 주었다. 연출용 툴에는 ( http://violetababel.tistory.com/406 )123456789101112131415161718192021222324252627Make moomin.jpg a 0.5 0.5 1 n Dialog grey_panel.png panel 0 -3 16 3 ChangeCol..
12345678910111213141516171819202122232425//TimeManager.csusing System.Collections;using System.Collections.Generic;using UnityEngine; public class TimeManager : MonoBehaviour{ static public float GameTime = 0; static public bool bTimeStop = false; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (bTimeStop) GameTime = 0; else GameTime = Time..
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816..
1234567891011121314151617181920212223242526//TimeManager.csusing System.Collections;using System.Collections.Generic;using UnityEngine; public class TimeManager : MonoBehaviour{ static public float GameTime = 0; static public bool bTimeStop = false; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (bTimeStop) GameTime = 0; else GameTime = Ti..
교수님께서 보여주신 풀링과 싱글톤 예시 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950using System.Collections;using System.Collections.Generic;using UnityEngine; public class LazerPool : MonoBehaviour { public GameObject mLazer = null; private static LazerPool mPool = null; private Queue mQueue = new Queue(); private LazerPool() { //프라이빗으로 해줌으로서 다른 클래스에서 이 클래스 객체를 만드려..