'Computer Language > 유니티' 카테고리의 다른 글
진행중 gamecontroller (0) | 2014.06.10 |
---|---|
바둑 주석 (0) | 2014.05.29 |
LookAt() (0) | 2014.05.23 |
vector3 사용예제 (0) | 2014.05.23 |
불 껏다 키기 (0) | 2014.05.23 |
진행중 gamecontroller (0) | 2014.06.10 |
---|---|
바둑 주석 (0) | 2014.05.29 |
LookAt() (0) | 2014.05.23 |
vector3 사용예제 (0) | 2014.05.23 |
불 껏다 키기 (0) | 2014.05.23 |
using UnityEngine;
using System.Collections;
public class Turret : MonoBehaviour {
public Transform target;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.LookAt(target);
}
}
바둑 주석 (0) | 2014.05.29 |
---|---|
값과 주소. (0) | 2014.05.26 |
vector3 사용예제 (0) | 2014.05.23 |
불 껏다 키기 (0) | 2014.05.23 |
껏다 켯다 하기 (0) | 2014.05.23 |
using UnityEngine;
using System.Collections;
public class newsource : MonoBehaviour {
public int hp;
public float moveSpeed = 10.0f;
public float turnSpeed = 50.0f;
void Awake(){
print ("Awake name = " + name);
}
void OnEnable(){
print ("OnEnabel name = " + name);
}
void OnDisable(){
print ("OnDisable name = " + name);
}
// Use this for initialization
void Start () {
print ("Start name = " + name);
}
void Reset(){
print ("Reset name = " + name);
hp = 20;
}
void FixedUpdate(){
//print ("FixedUpdate = " + Time.deltaTime);
}
// Update is called once per frame
void Update () {
if(Input.GetKey(KeyCode.UpArrow)){
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
if(Input.GetKey(KeyCode.DownArrow)){
transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);
}
if(Input.GetKey(KeyCode.LeftArrow)){
transform.Rotate(Vector3.up *-turnSpeed * Time.deltaTime);
}
if(Input.GetKey(KeyCode.RightArrow)){
transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime);
}
if(Input.GetKeyDown(KeyCode.R)){
gameObject.renderer.material.color = Color.red;
}
if(Input.GetKeyDown(KeyCode.G)){
gameObject.renderer.material.color = Color.green;
}
if(Input.GetKeyDown(KeyCode.B)){
gameObject.renderer.material.color = Color.blue;
}
}
}
값과 주소. (0) | 2014.05.26 |
---|---|
LookAt() (0) | 2014.05.23 |
불 껏다 키기 (0) | 2014.05.23 |
껏다 켯다 하기 (0) | 2014.05.23 |
생명 주기와 색깔 바꾸기 (0) | 2014.05.23 |