- 627 名前:名前は開発中のものです。 mailto:sage [2015/03/28(土) 21:07:38.77 ID:bC4IvWTN.net]
- >>598
public var bullet : GameObject; public var spawner : Transform; public var speed : float = 1000; public var rifle : Transform; public var interval : float = 0.3; private var time : float = 0; function Update () { time += Time.deltaTime; if(Input.GetButton("Fire1")){ time += Time.deltaTime; if(time >= interval){ Shot(); Score.score -= 1; time = 0; } } } //Shot関数 function Shot (){ var obj : GameObject = GameObject.Instantiate(bullet, transform.position, Quaternion.Euler(90, 360, 0)); obj.transform.position = spawner.position; obj.GetComponent.<Rigidbody>().AddForce(-rifle.forward * speed); }
|

|