Created
April 19, 2015 15:12
-
-
Save suakig/66449a7710a1f8174ce7 to your computer and use it in GitHub Desktop.
Bullet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
/// <summary> | |
/// Gun.csクラスによって生成された弾丸の処理クラス | |
/// </summary> | |
public class Bullet : MonoBehaviour | |
{ | |
public float speed; | |
public float deleteTime; | |
public virtual void Start() | |
{ | |
this.rigidbody.velocity = this.transform.forward * speed; | |
} | |
/// <summary> | |
/// 初期化 | |
/// </summary> | |
/// <param name="gun">Gun.</param> | |
public virtual void Init(GameObject gun) | |
{ | |
this.name = this.GetType().Name; | |
this.transform.rotation = gun.transform.rotation; | |
this.transform.position = gun.transform.position; | |
Destroy (this.gameObject, deleteTime); | |
this.transform.parent = Stage.Instance.transform; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment