http://raharu0425.hatenablog.com/entry/20140109/1389247546
public class Openguin : MonoBehaviour {
public GameObject Bullet;
// 毎フレーム呼ばれる
void Update () {
Move();
}
void Move()
{
Vector2 position = transform.position;
if (Input.GetKey("left"))
{
position.x -= speed.x;
// Vector3 の X軸を -1にすることでX軸を反転させている
transform.localScale = new Vector3(-1, 1, 1);
}
else if (Input.GetKey("right"))
{
position.x += speed.x;
transform.localScale = new Vector3(1, 1, 1);
}
transform.position = position;
}
}