C# ゲーム 減速
using UnityEngine;
using System.Collections;
public class CarController : MonoBehaviour {
float speed = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetMouseButtonDown(0)) { // もし、マウスがクリックされたら
this.speed = 0.3f; //速度 初期値
}
transform.Translate(this.speed, 0, 0);
this.speed *= 0.97f; // 減速
}
}