using UnityEngine;
using System.Collections;

public class Road : MonoBehaviour {
 
 public float speed = 3.0f;    //public을 넣지 않으면 Inspector에서 수정불가능.
 public float x = 0;
 public float y = 0;
 
 // Use this for initialization
 void Start () {   // 시작하기 전에 세팅이나 초기화.
  
  
 
 }
 
 // Update is called once per frame
 void Update () { //게임이 종료될때 까지 계속해서 구동되는 부분
  
  y = y + Time.deltaTime * speed;
  renderer.material.mainTextureOffset = new Vector2(x,-y);  //위에서 밑으로 내려오는 건 음수 올라가는건 양수
  //x z ㅇ축은 안움직이기 때문에 Vector2로 기본값 설정
 }
}

'유니티3D > 예제' 카테고리의 다른 글

PlayerCrtl  (0) 2013.07.25
PlayerCtrl_소스  (0) 2013.07.24
자동차게임 전체 스크립트  (0) 2013.07.23
도로밖으로 차 못나가게 하기  (0) 2013.07.22
자동차 좌우 이동  (0) 2013.07.22

+ Recent posts