[ShootingGame] 13. 게임 확장 - 편의성 개선 (조이스틱, 일시정지, 보스HP바, 등등)
1. 조이스틱
- 기존 조이 패널은 드래그 시에 영역을 벗어나면 이동이 풀리는, 등의 문제와 유저 편의성이 너무 떨어져 조이스틱으로 변경
+ 드래곤 플라이트처럼 변경할까 했지만, 그럼 게임 기획 상 이동속도 제한을 해야하는데, 그러면 오히려 불편하고, 시야도 손으로 자주 가리게 될 것으로 예상되어 조이스틱으로 변경함
https://godgjwnsgur7.tistory.com/28
[Unity] 모바일 터치 감지 방법
1. MonoBehaviour.OnMouseXX 함수 모바일에서는 커서가 올라가면 호출되는 함수는 터치시에 호출됨 https://docs.unity3d.com/kr/530/ScriptReference/MonoBehaviour.html Unity - 스크립팅 API: MonoBehaviour J..
godgjwnsgur7.tistory.com
RectTransformUtillity.ScreenPointToLocalPotinInRectangle( RectTransform rect, Vector2 screenPoint, Camera camera, out Vector2 touchPosition );
RectTransform rect : 터치되는 이미지의 RectTransform 정보
Vector2 screenPoint : 화면 터치 좌표
Camera camera : 현재 화면에 대한 카메라
out Vector2 touchPosition : 저장된 연산된 좌표
+ 현재 스크립트를 사용하는 가상 조이스틱 배경 이미지의 중심축(Pivot)은 왼쪽 하단
1. 배경 이미지 크기로 나누어 0 ~ 1 사이의 값으로 정규화 // (배경 - 조이스틱 터치 감지 영역)
2. 피벗의 중심이 왼쪽 하단이기 때문에, 이미지의 중심을 0으로 잡기 위해 *2 - 1 연산
3. 조이스틱 배경 이미지 밖으로 드래그하게 되면 -1 ~ 1의 영역을 벗어날 수 있기 때문에, touchPosition의 길이가 1을 넘어갔을 경우 normalized로 -1 ~ 1 사이의 값으로 정규화시킴
Unity - Scripting API: RectTransformUtility.ScreenPointToLocalPointInRectangle
The cam parameter should be the camera associated with the screen point. For a RectTransform in a Canvas set to Screen Space - Overlay mode, the cam parameter should be null. When ScreenPointToLocalPointInRectangle is used from within an event handler that
docs.unity3d.com
2. 일시정지
3. 보스 HP바
+ 이외의 다수의 버그를 잡고 게임 편의성, 등을 위해 로직을 전체적으로 변경, 추가
https://github.com/godgjwnsgur7/ShootingGame
GitHub - godgjwnsgur7/ShootingGame
Contribute to godgjwnsgur7/ShootingGame development by creating an account on GitHub.
github.com
강의 출처
https://www.youtube.com/playlist?list=PLO-mt5Iu5TeYtWvM9eN-xnwRbyUAMWd3b
유니티 2D 종스크롤 슈팅 모바일 [BE4]
유니티 2D 아케이드 느낌을 살린 종스크롤 슈팅게임 개발 기초 강좌 채널. 에셋 : http://u3d.as/2mLG
www.youtube.com