コード例 #1
0
    void Start()
    {
        transform.SetParent(BULLET_ANCHOR, true);

        AsteraX.AddBullet(this);

        // Set Bullet to self-destruct in lifeTime seconds
        Invoke("DestroyMe", lifeTime);

        // Set the velocity of the Bullet
        GetComponent <Rigidbody>().velocity = transform.forward * bulletSpeed;

        // Attach the particle effect
        GameObject pe = Instantiate <GameObject>(particleEffectPrefab);

        pe.transform.SetParent(transform);
        pe.transform.localPosition = Vector3.zero;
    }