본문 바로가기

프로그래밍

(65)
[Unity] Mouse 이벤트 (다운, 업, 클릭, 드래그) [Unity] Mouse 이벤트 (다운, 업, 클릭, 드래그) 마우스 다운, 업 이벤트 - PointerEventData로 pointerId, position 등을 알수 있다. using UnityEngine; using UnityEngine.EventSystems; public class Example : MonoBehaviour, IPointerDownHandler, IPointerUpHandler { //Detect current clicks on the GameObject (the one with the script attached) public void OnPointerDown(PointerEventData pointerEventData) { //Output the name of the Game..
[Unity] Mouse 클릭한 지점에 객체 생성하기 (Ray 사용) [Unity] Mouse 클릭한 지점에 객체 생성하기 (Ray 사용) using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public GameObject particle; void Update() { if (Input.GetButtonDown("Fire1")) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray)) Instantiate(particle, transform.position, transform.rotation); } } }
[Unity] 버튼에 마우스 클릭 이벤트 사용하기 Unity 버튼에 마우스 클릭 이벤트 사용하기 using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { //Make sure to attach these Buttons in the Inspector public Button m_YourFirstButton, m_YourSecondButton, m_YourThirdButton; void Start() { //Calls the TaskOnClick/TaskWithParameters/ButtonClicked method when you click the Button m_YourFirstButton.onClick.AddListener(TaskOnClick); m_YourSeco..
[Unity] 마우스 방향으로 이동 Unity 마우스 방향으로 이동 public Camera mainCamera; //메인 카메라 public float maxSpeed; //최대 속도 public float aclrt; //가속도 private float curr_speed; //현재 속도 private void Update () { if (Input.GetMouseButton (0)) { Ray ray = mainCamera.ScreenPointToRay (Input.mousePosition); RaycastHit hit; if (Physics.Raycast (ray, out hit, Mathf.Infinity) { Vector3 dir = new Vector3 (hit.point.x - transform.position.x, 0f, ..
[Unity] 마우스 클릭 지점으로 이동 Unity 마우스 클릭 지점으로 이동 using UnityEngine; public class ClickMove : MonoBehaviour { private Ray ray; private RaycastHit hit; private Vector3 movePos = Vector3.zero; private Transform tr; private Animator anim; // Use this for initialization void Start () { tr = GetComponent(); anim = GetComponent(); } // Update is called once per frame void Update () { ray = Camera.main.ScreenPointToRay(Input.mouse..
[Unity] 캐릭터 좌우로 움직이기 (RigidBody) Unity 캐릭터 좌우로 움직이기 (RigidBody) [Header("속도 관련 변수")][Range(0,1)] [SerializeField] float moveSpeed; //강제로 인스펙터 창에 띄울 수 있음 Rigidbody myRigid; // Update is called once per frame void Update () { if (Input.GetAxisRaw("Horizontal") != 0) // 왼쪽 -1, 오른쪽 1 { Vector3 moveDir = new Vector3(0, 0, Input.GetAxisRaw("Horizontal")); myRigid.AddForce(moveDir * moveSpeed); } }
애플 리젝 사유 2. 기능성 2.1 (시스템을) 고장내는 앱은 승인하지 않는다. 2.2 버그가 발견되는 앱은 승인하지 않는다. 2.3 개발자가 명시한대로 작동하지 않는 앱은 승인하지 않는다. 2.4 문서 상의 설명과는 일치하지 않는 숨겨진 요소 혹은 불법적 요소를 포함한 앱은 승인하지 않는다. 2.5 공개되지 않은 API(어플리케이션 프로그래밍 인터페이스)를 사용한 앱은 승인하지 않는다. 2.6 할당된 공간 외의 곳에서 데이터를 읽거나 쓰는 앱은 승인하지 않는다. 2.7 어떤 방식이나 형태로든 코드를 다운받는 앱은 승인하지 않는다. 2.8 다른 실행 가능한 코드를 인스톨 혹은 실행시키는 앱은 승인하지 않는다. 2.9 “베타”, “데모”, “체험판” 혹은 “테스트” 버전인 앱들은 승인하지 않는다. 2.10 아이폰 앱은 별..
UIImageView 프레임 애니메이션 사용하기 이미지를 프레임으로 보여주고 싶을 경우에는 UIImageView의 animationImages 속성을 사용하면 됩니다. ex ) UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(40, 30, 200, 200)]; imgView.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"img_satelite01.png"], [UIImage imageNamed:@"img_satelite02.png"], [UIImage imageNamed:@"img_satelite03.png"], [UIImage imageNamed:@"img_satelite04.png"], nil]; [i..