예제 #1
0
    protected Bullet_Base _BulletFired; // Which bullet was most recently fired. Used to cutdown on garbage collection.

    public override bool Initialize()
    {
        if (!base.Initialize())
        {
            return(false);
        }

        // Initialize the buffer and add bullets into the buffer
        _bulletBuffer = new Buffer <Bullet_Base>(null, null);
        GameObject bullet;

        for (int i = 0; i < _BufferSize; i++)
        {
            bullet = Instantiate <GameObject>(_BulletPrefab);
            bullet.transform.SetParent(transform);
            bullet.SetActive(false);
            bullet.GetComponent <Bullet_Base>().Initialize(this);
            _bulletBuffer.AddObject(bullet.GetComponent <Bullet_Base>());
        }

        _tm_Fire = new Timer();

        return(true);
    }