Skip to content

Instantly share code, notes, and snippets.

@suakig
Created April 19, 2015 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suakig/66449a7710a1f8174ce7 to your computer and use it in GitHub Desktop.
Save suakig/66449a7710a1f8174ce7 to your computer and use it in GitHub Desktop.
Bullet.cs
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