본문 바로가기
반응형

Programing/unity21

유니티,unity, 하늘에서 떨어지는 것 받기 게임,똥피하기 게임 // 받는 플레이어 삽입 스크립트 using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI; public class Move : MonoBehaviour { public GameObject ball; // 플레이어에서 ball 오브젝트를 스크립트에 삽입 int r; //랜덤위치 int np=3; // 남은 회수 public Text text; // Text 오브젝트를 스크립트에 삽입 void Start () {}// Update is called once per framevoid Update () {text.text = "남은 횟수:"+np.ToString ();r=Random.Range .. 2017. 2. 27.
유니티,unity,다른오브젝트의 위치에 따라서 방향바꾸기 public Transform enemy; // = // enemy 오브젝트를 플레이어 스크립트 있는 빈곳에 넣어준다..void Update () {transform.LookAt (enemy);} // 밑과 동일 private Transform enemy; void Start(){enemy = transform.Find ("/Enemy1");}void Update () {transform.LookAt (enemy);} 2017. 2. 26.
unity,유니티,Raycast 여러오브젝트 검사,DrawRay,RaycastAll,RaycastHit using System.Collections;using System.Collections.Generic;using UnityEngine; public class CsRaycast : MonoBehaviour { private float speed = 5.0f;// Update is called once per framevoid Update () {float amtMove = speed * Time.deltaTime;float hor = Input.GetAxis ("Horizontal");transform.Translate (Vector3 . right * hor*amtMove); Debug.DrawRay (transform.position,transform.forward*8,Color.red);// 레이.. 2017. 2. 26.
유니티,unity,Raycast를 통해 앞쪽의 오브젝트 파악하기,DrawRay,RaycastHit using System.Collections;using System.Collections.Generic;using UnityEngine; public class CsRaycast : MonoBehaviour { private float speed = 5.0f;// Update is called once per framevoid Update () {float amtMove = speed * Time.deltaTime;float hor = Input.GetAxis ("Horizontal");transform.Translate (Vector3 . right * hor*amtMove); Debug.DrawRay (transform.position,transform.forward*8,Color.red);// 레이.. 2017. 2. 26.
반응형