- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
using UnityEngine;
using System.Collections;
public class move : MonoBehaviour {
public GameObject walk;
public GameObject Stay;
public Transform wgon;
// Use this for initialization
void Awake ()
{
walk.SetActive(false);
Stay.SetActive(false);
}
// Update is called once per frame
void Update ()
{
if(Input.GetKey(KeyCode.W))
{
walk.SetActive(true);
Stay.SetActive(false);
wgon.transform.Translate(0.0f, 0.0f, 0.3f);
}
if(Input.GetKeyUp(KeyCode.W))
{
walk.SetActive(false);
Stay.SetActive(true);
}
if(Input.GetKey(KeyCode.D))
{
wgon.transform.Rotate(0.0f, 0.5f, 0.0f);
}
if(Input.GetKey(KeyCode.A))
{
wgon.transform.Rotate(0.0f, -0.5f, 0.0f);
}
}
}