2016年12月1日 星期四

12/2 繞一圈



using UnityEngine;
using System.Collections;

public class NewBehaviourScript1 : MonoBehaviour
{

Vector3[] T = new Vector3[4];
// Use this for initialization
void Start()
{
T[0] = new Vector3(12f, 0, 12f);
T[1] = new Vector3(-12f, 0, 12f);
T[2] = new Vector3(-12f, 0, -8f);
T[3] = new Vector3(12f, 0, -8f);

}
int aa = 0;

// Update is called once per frame
void Update()
{
transform.position = Vector3.MoveTowards(transform.position, T[aa], 10 * Time.deltaTime);
if (transform.position == T[aa])
aa = (aa + 1) % 4;
if(Input.GetKey(KeyCode.RightArrow))
transform.Rotate(Vector3.up* 20*Time.deltaTime);

}
}

沒有留言:

張貼留言